An option(al) to surprise you -- Andreas Fertig
In today's post I share a learning of a customer with you. A while back, a customer asked me to join a debugging session. They had an issue they didn't (fully) understand.
An option(al) to surprise you
by Andreas Fertig
From the article:
The base
What I will show you is a much down-stripped and, of course, altered version. It was about a message system, but that's not important. Have a look at the code below.
You can see a class enum for a state and a function
Worker. The function takes aStateand aconst char*message nameddata. The function's job is to create astd::optionalcontaining the user data, a C-style string.


Registration is now open for CppCon 2025! The conference starts on September 15 and will be held
A unique milestone: “Whole new language”
Registration is now open for CppCon 2025! The conference starts on September 15 and will be held
Templates are one of C++’s most powerful features, enabling developers to write generic, reusable code—but they come with a cost: notoriously verbose and opaque error messages. With the introduction of concepts in C++20, we can now impose clear constraints on template parameters and get far more helpful diagnostics when something goes wrong.
Registration is now open for CppCon 2025! The conference starts on September 15 and will be held
C++’s One Definition Rule (ODR) can cause subtle and hard-to-detect issues when compile-time switches lead to inconsistent definitions across translation units. However, by using type aliases and template instantiation, we can sidestep these violations—giving each module its own definition without triggering undefined behavior.
Registration is now open for CppCon 2025! The conference starts on September 15 and will be held