June 2025
Intermediate to advanced
1093 pages
33h 24m
English
Throughout this book, I have occasionally noted that a particular feature is only available from C++17, C++20, or C++23 onward. And from time to time, I mentioned that some compilers do not yet support a feature. From C++20 onward, there is an official way to check if the compiler or the standard library supports a particular feature. You can then respond to such conditions with #if or #ifdef. These feature macros are then defined and have a numerical value like 201707L:
#if __cpp_generic_lambdas >= 201707L // Here you can use generic lambdas with template parameters.#else // Here you have to do without them.#endif#ifdef __cpp_lib_as_const // Here there is std::as_const(coll).#else // Here not.#endif
The list for the ...
Read now
Unlock full access