Write More C++ Code Thanks to constexpr -- Andreas Fertig
Since its introduction, constexpr in C++ has evolved significantly, offering powerful ways to optimize code at compile-time. This article shares a real-world story of using constexpr to dramatically reduce memory usage and code size in an embedded system, showcasing its potential to improve both performance and efficiency.
Write More C++ Code Thanks to constexpr
by Andreas Fertig
From the article:
I'm a big fan of
constexprand am not alone. Jason Turner is also very vocal, having coined the term "constexpr all the things".Well, demonstrating the powers of
constexpris nonetheless something difficult. I know that from my training classes and various consulting contracts. Today, I'd like to share a story from back in time when a customer hired me to consult. They did develop an embedded system and ran out of memory. Not during run-time, but before. The features they wanted to put in the chip were too big in code size and somewhat RAM.Initial
constexpr-free exampleThey used a class I've seen a couple of times in embedded systems with some variations. A string brings its memory picky-back.

We all know that every ‘,’ matters in this language, so I decided to talk directly about that character today. So, how much impact can be for such a small little character?
The topic of this post is to show different ways to ensure that a class is either non-moveable or non-copyable.
In C++, associating member objects like properties or events with their containing class often requires passing this redundantly. This article explores a generalized, flexible solution using templates, variadic arguments, and deducing this to streamline ownership initialization without boilerplate.
Jonathan Müller attended the fall 2024 meeting of the ISO C++ standardization committee in Wrocław, Poland. This was the fifth meeting for the upcoming C++26 standard and the feature freeze for major C++26 features.
While most time zones use simple hour offsets from UTC, some regions have chosen unusual time differences. In this blog post, we’ll explore how we can discover such zones using C++20’s chrono library.