Modern C++: An Introduction
Tags: cpp, beginners, tutorial, codenewbie
Published: 2019-12-23 15:59:41

Most people think that they know C++ which is used in production level as they  are taught C++ in their syllabus of their university/college. But they mostly do not know what standard of C++ they are taught. They are taught C++ 89 i.e. [CFront 2.0](https://en.cppreference.com/w/cpp/language/history). Students are told to use [Turbo C++](https://en.wikipedia.org/wiki/Turbo_C%2B%2B) as IDE to learn C++ in university because it is or _was_ a great IDE in it's age. As the academic syllabus takes a lot of time to change and people don't know that it is outdated mostly trend to learn old coding styles and deprecated features.

# What is Modern C++?

Modern C++ stands for C++ that is based on C++11, C++14, and C++17 C++20 and future versions.

With C++11 we had a revolution. That revolutions became with C++14 and will become with C++17 to an evolution. An overview on the time line of C++ features which makes my point clear.

![](https://ww.w.modernescpp.com/images/blog/ModernCpp/timeline.png)

 Modern C++ not only enhances the usability of the C++ itself, but the modification of the `auto` keyword semantics gives more confidence in manipulating extremely complex template types. At the same time, a lot of enhancements have been made to the language at runtime. The emergence of Lambda expressions has made C++ have the "closure" feature of "anonymous functions", which is almost in modern programming languages ​​(such as Python/Swift/.. It has become commonplace, and the emergence of `rvalue` references has solved the problem of temporary object efficiency that C++ has long been criticized for.

## Deprecated Features

- The string literal constant is no longer allowed to be assigned to a `char *`. If you need to assign and initialize a `char *` with a string literal constant, you should use `const char *` or `auto`.
```cpp
char *str = "hello world!"; // A deprecation warning will appear
```

- C++98 `exception description`, `unexpected_handler`, `set_unexpected()` and other related features are deprecated and should use `noexcept`.

- `auto_ptr` is deprecated and `unique_ptr` should be used.

- `register` keyword is deprecated and can be used but no longer has any practical meaning.

- `bool` can no longer be incremented 

- If a class has a `destructor`, the properties for which it generates copy constructors and copy assignment operators are deprecated.

- C language style type conversion is deprecated (ie using (convert_type)) before variables, and `static_cast`, `reinterpret_cast`, `const_cast` should be used for type conversion.

- In particular, some of the C standard libraries that can be used are now deprecated in the latest C++ standard, such as `<ccomplex>`, `<cstdalign>`, `<cstdbool>` and `<ctgmath>`.

- Many more that I cannot remember.

### Resources of learning Modern C++

- [AwesomePerfCpp](https://github.com/fenbf/AwesomePerfCpp)
- [Modern C++ Book](https://github.com/changkun/modern-cpp-tutorial)
- [Best Practices](https://github.com/lefticus/cppbestpractices)
- [Awesome Modern C++](https://github.com/rigtorp/awesome-modern-cpp)
- [Modern C++ Tutorials](https://www.modernescpp.com/index.php)
- [Iso C++](https://isocpp.org/)
- [30 Seconds of C++](https://github.com/Bhupesh-V/30-seconds-of-cpp)
- [C++ Preference](https://en.cppreference.com/w/)


### List of Posts made by me 

{% post https://dev.to/delta456/modern-c-raw-strings-5c25 %}
{% post https://dev.to/delta456/modern-c-and-or-and-not-as-boolean-operators-2jgf %}
{%post https://dev.to/delta456/modern-c-constexpr-38bk %}
{%post https://dev.to/delta456/modern-c-temp-vars-in-if-switch-ig0 %}
{%post https://dev.to/delta456/modern-c-lambdas-3pjl %}
{%post https://dev.to/delta456/modern-c-enum-class-struct-m2f %}
{% post https://dev.to/delta456/c-named-operators-56f2 %}


### Github

All the code used in my articles are available on [Delta456/modern-cpp-series](https://github.com/Delta456/modern_cpp_series).

{%github https://github.com/Delta456/modern_cpp_series %}