Two new Keywords in C++20: consteval and constinit
With C++20, we get two new keywords: consteval and constinit. consteval produces a function executed at compile-time, and constinit guarantees that a variable is initialized at compile-time.
This author has not written his bio yet.
But we are proud to say that Rainer Grimm contributed 702 entries already.
With C++20, we get two new keywords: consteval and constinit. consteval produces a function executed at compile-time, and constinit guarantees that a variable is initialized at compile-time.
Designated initialization is an extension of aggregate initialization and empowers you to directly initialize the members of a class type using their names.
In this post, I conclude my miniseries on the three-way comparison operator with a few subtle details. The subtle details include the compiler-generated == and != operators and the interplay of classical comparison operators, and the three-way comparison operator.
The compiler performs cleverly when it generates all six comparison operators. Ultimately, you get intuitive and efficient comparison operators for free. Let me dive into this post into the details of the spaceship operator.
The three-way comparison operator <=> is often just called the spaceship operator. The spaceship operator determines whether A < B, A = B, or A > B for two values, A and B. You can define the spaceship operator, or the compiler can auto-generate it.
So far, I have written in my last four posts the basics you should know about modules in C++20. Only a few questions about modules are still open. In this post, I address these open questions, such as templates in modules, the linkage of modules, and header units.
When your module becomes bigger, you want to divide its functionality into manageable components. C++20 modules offer two approaches: submodules and partitions. Let me discuss both approaches in this post.
Thanks to the module interface unit and implementation unit, you can separate the interface from the implementation when defining a module. Let me show you how.
Modules are one of the four prominent features of C++20. They overcome the restrictions of header files and promise a lot: faster build-times, fewer violations of the One-Definition-Rule, less usage of the preprocessor. Today, I want to create a simple math module.
I’m happy to announce that I offer English and German online seminars.
