Feature Testing
Explore how to verify compiler support for C++20 features using the <version> header and its feature testing macros. Understand how to identify implemented attributes, language features, and library support across common compilers like GCC, Clang, and MSVC. This lesson helps you assess and experiment with new C++20 features in your development environment.
We'll cover the following...
The header <version> allows you to ask your compiler for its C++11 or later support. You can ask for attributes, features of the core language, or the library. <version> has about 200 macros defined, which expand to a number when the feature is implemented. The number stands for the year and the month in which the feature was added to the C++ standard. These are the numbers for static_assert, lambdas, and concepts.
🔑 Feature support
When I experiment ...