C++ Forbidden Black Magic: STMP (Part 2)

This article was translated by AI using Gemini 2.5 Pro from the original Chinese version. Minor inaccuracies may remain. In the previous article, we gained a preliminary understanding of the principles of STMP and used it to implement a simple compile-time counter. However, its power extends far beyond that. This article will discuss some advanced applications based on STMP. ...

2023-07-30 · Updated 2026-03-14 · 8 min · 1593 words · ykiko

C++ Forbidden Black Magic: STMP (Part 1)

This article was translated by AI using Gemini 2.5 Pro from the original Chinese version. Minor inaccuracies may remain. As is well known, traditional C++ constant expression evaluation neither depends on nor changes the global state of the program. For any identical input, its output is always the same, and it is considered purely functional. Template Meta Programming, as a subset of constant evaluation, should also adhere to this rule. ...

2023-07-29 · Updated 2026-03-14 · 11 min · 2137 words · ykiko