More Convenience Functions for Containers with C++20

Removing elements from a container or asking if an associative container has a specific key, is too complicated. I should say was because with C++20 the story changes.

Read more
Views: 14246

constexpr std::vector and std::string in C++20

Probably the most viral keyword in modern C++ is constexpr. With C++20, we have a constexpr std::vector and a constexpr std::string. Additionally, both containers can be manipulated with the constexpr algorithms of the Standard Template Library. 

Read more
Views: 4192

std::span in C++20: Bounds-Safe Views for Sequences of Objects

In my seminar, I often hear the question: How can I safely pass a plain array to a function? With C++20, the answer is quite easy: Use a std::span.

Read more
Views: 4060

volatile and Other Small Improvements in C++20

Today, I complete my tour through the C++20 core language features with a few small improvements. One interesting of these minor improvements is that most of volatile has been deprecated.

Read more
Views: 6227

New Attributes with C++20

With C++20, we got new and improved attributes such as [[nodiscard("reason")]], [[likely]], [[unlikely]], and [[no_unique_address]]. In particular, [[nodiscard("reason")]] allows it to express the intention of your interface way clearer.

Read more
Views: 7042

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: 5061

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: 6350

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: 6229

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: 8539

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: 26871

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 9316

Yesterday 13046

Week 30218

Month 169979

All 4620071

Currently are 187 guests and no members online

Kubik-Rubik Joomla! Extensions

Latest comments