May 13, 2026
Enum-ous drama, zero chill
Cost of enum-to-string: C++26 reflection vs. the old ways
C++ fans clash over fancy new enum tricks as old-school macros steal the spotlight
TLDR: A new benchmark tested whether C++26’s upcoming reflection feature is worth using for a simple enum-to-text helper, and the answer sparked a style war. Commenters split between “this looks alien,” “just give us the simple feature,” and “old macros win again,” showing how tool design affects everyday coding pain.
A fresh benchmark comparing ways to turn enum values into readable text should have been a dry performance story. Instead, the comment section instantly turned it into a culture war between shiny new language features and scrappy old-school hacks. The article revisits a previous compile-time cost test using the now-official GCC 16 release and asks a very practical question: if developers use the upcoming C++26 reflection feature for a simple job like enum-to-string conversion, how much pain are they buying? The contenders were the slick new reflection method, a clever library workaround, and the ancient survivor nobody can kill off: X-macros.
And wow, people had feelings. One commenter looked at the new reflection syntax and basically said it felt like staring at an alien language if you grew up on older C++. Another jumped straight to the real-world panic button: how do you even debug this stuff? If old macro-heavy code is already miserable to step through, what happens when the magic happens entirely during compilation? Meanwhile, the anti-fancy crowd had a field day, with one person declaring it “another win for X macros and for C style in general,” which is exactly the kind of sentence that can start a week-long flame war.
Then came the weary humor: why, one commenter asked, couldn’t the language just give people a simple built-in to_string(enum) and spare everyone the drama? Another used the whole debate to lobby for a bigger dream: forget more features, make compile times the mission for the next version. In other words, the benchmark measured code, but the community measured patience.
Key Points
- •The article revisits compile-time benchmarking of C++26 reflection after the official release of GCC 16.
- •The benchmark uses enum-to-string conversion as a practical example and compares three approaches: C++26 reflection, Enchantum, and X-macros.
- •The reflection example uses `<meta>` and `std::meta::enumerators_of` to implement a generic enum-to-string function for any enum type.
- •The benchmark varies enum sizes across 4, 16, 64, 256, and 1024 enumerators and forces instantiation by calling the conversion function with a runtime value.
- •The author separately measures header-include cost to distinguish header overhead from the actual enum conversion or reflection work.