C++20

More Lambda Features with C++20

Lambdas in C++20 can be default-constructed and support copy-assignment when they have no state. Lambdas can be used in unevaluated contexts. Additionally, they detect when you implicitly copy the this pointer. This means a significant cause of undefined-behavior with lambdas is gone.

Read more
Tags: lambdas, C++20
Views: 5104

More Powerful Lambdas with C++20

Thanks to C++20, lambdas become more powerful. From the various lambda improvements, template parameters for lambdas are my favorite ones.

Read more
Views: 6389

Various Template Improvements with C++20

Admittedly, I present in this post a few small improvements to templates and to C++20 in general. Although these improvements may seem not so impressive to you, they make C++20 more consistent and, therefore, less error-prone when you program generic.

Read more
Views: 6254

Solving the Static Initialization Order Fiasco with C++20

According to the FAQ of isocpp.org is the static initialization order fiasco "a subtle way to crash your program". The FAQ continues: The static initialization order problem is a very subtle and commonly misunderstood aspect of C++. ". Today, I write about this very subtle and misunderstood aspect of C++.  

Read more
Views: 8596

Two new Keywords in C++20: consteval and constinit

With C++20 we get two new keywords: consteval and constinit. consteval produces a function that is executed at compile-time and constinit guarantees that a variable is initialized at compile-time.

Read more
Tags: C++20
Views: 26929

Designated Initializers

Designated initialization is an extension of aggregate initialization and empowers you to directly initialize the members of a class type using their names.

Read more
Views: 15605

C++20: Optimized Comparison with the Spaceship Operator

In this post, I conclude my miniseries to the three-way comparison operator with a few subtle details. The subtle details include the compiler-generated the == and != operators and the interplay of classical comparison operators and the three-way comparison operator.

Read more
Views: 4786

C++20: More Details to the Spaceship Operator

The compiler performs quite a clever job when it generates all six comparison operators. On the end, you get the intuitive and efficient comparison operators for free. Let me dive with this post into the details of the spaceship operator.

Read more
Views: 17209

C++20: The Three-Way Comparison Operator

The three-way comparison operator <=> is often just called spaceship operator. The spaceship operator determines for two values A  and B whether A < B, A = B, or A > B. You can define the spaceship operator or the compiler can auto-generate it for you.

Read more
Views: 57154

C++20: Further Open Questions to Modules

So far, I have written in my last four posts the basics you should know about modules in C++20. Only a few questions to modules are still open. In this post, I address these open questions, such as templates in modules, the linkage of modules, and header units.

Read more
Tags: modules, C++20
Views: 6326

My Newest E-Books

Course: Modern C++ Concurrency in Practice

Course: C++ Standard Library including C++14 & C++17

Course: Embedded Programming with Modern C++

Course: Generic Programming (Templates)

Course: C++ Fundamentals for Professionals

Subscribe to the newsletter (+ pdf bundle)

Blog archive

Source Code

Visitors

Today 8030

Yesterday 10139

Week 39071

Month 8030

All 4628924

Currently are 152 guests and no members online

Kubik-Rubik Joomla! Extensions

Latest comments