Learning Modern Core Language Features
The C++ language has gone through a major transformation in the past decade with the development and release of C++11 and then, later, with its newer versions: C++14, C++17, and C++20. These new standards have introduced new concepts, simplified and extended existing syntax and semantics, and overall transformed the way we write code. C++11 looks like a new language, and code written using the new standards is called modern C++ code.
The recipes included in this chapter are as follows:
- Using
auto
whenever possible - Creating type aliases and alias templates
- Understanding uniform initialization
- Understanding the various forms of non-static member initialization
- Controlling and querying object alignment
- Using scoped enumerations
- Using
override
andfinal
for virtual methods - Using range-based for loops to iterate on a range
- Enabling range-based for loops for custom types
- Using explicit...