Runtime polymorphism usually connects with v-tables and virtual functions. However, in this blog post, I’ll show you a modern C++ technique that leverages std::variant and std::visit. This C++17 technique might offer not only better performance and value Read Full
Tag: Cpp20
C++20 Ranges, Projections, std::invoke and if constexpr
Continuing the topic from last week, let’s dive into the topic of std::invoke. This helper template function helps with uniform syntax call for various callable object types and can greatly reduce the complexity of our generic code. Read Full
Increased Complexity of C++20 Range Algorithms Declarations – Is It Worth?
With the addition of Ranges and Concepts in C++20, our good old algorithm interfaces got super long “rangified” versions. For example, copy is now 4 lines long… and it’s just the declaration! template requires std::indirectly_copyable constexpr ranges::copy_result Read Full
How To Stay Sane with Modern C++
C++ grows very fast! For example, the number of pages of the C++ standard went from 879 pages for C++98/03 to 1834 for C++20! Nearly 1000 pages! What’s more, with each revision of C++, we get several Read Full
How to Check String or String View Prefixes and Suffixes in C++20
Up to (and including) C++17 if you wanted to check the start or the end in a string you have to use custom solutions, boost or other third-party libraries. Fortunately, this changes with C++20. See the article Read Full
C++ Lambda Week: Some Tricks
We’re on the last day of the lambda week. We have all the essential knowledge, and now we can learn some tricks! The Series This blog post is a part of the series on lambdas: The syntax Read Full
C++ Lambda Week: Going Generic
We’re in the third day of the lambda week. So far, you’ve learned basic syntax and how to capture things. Another important aspect is that lambdas can also be used in the “generic” scenarios. This is especially Read Full
C++ Lambda Week: Capturing Things
We’re in the second day of the lambda week. Today you’ll learn about the options you have when you want to capture things from the external scope. Local variables, global, static, variadic packs, this pointer… what’s possible Read Full
Lambda Week: Syntax changes, C++11 to C++20
Let’s start the week with Lambda Expressions. The plan is to have a set of concise articles presenting core elements of lambda expressions. Today you can see how the syntax has evolved since C++11 and what the Read Full
C++ Lambda Story is 100% Complete
I’m pleased to announce that I’ve finished the work on the latest update for C++ Lambda Story! This makes the book complete now, and I can finally set its status to 100%! Read on to see the Read Full