November 14, 20241 yr Programming at compile time has been possible in C++ for a long time. Wu Yongwei considers its past, present and future. Compile-time programming is a key feature of C++. It enables writing high-performance code often unattainable in other languages. This article explores its past, present, and future applications, highlighting the diverse possibilities in C++. WeÎÃÃll briefly cover template metaprogramming, constexpr, variadic templates, static reflection, and more. C++ Compile-Time Programming by Wu Yongwei From the article: Compile-time programming is vastly different from run-time programming. The code runs during compilation, but the results can be used at run time. Some believe compile-time programming is merely a trick, unused in real-world engineering. To them, I ask: do you use the C++ Standard Library? The mainstream implementations rely heavily on various programming techniques, including compile-time programming. ÎÃÿI donÎÃÃt write the standard libraryÎÃà ÎÃô this might be a possible response. But consider this: the standard library is just one tool, a standard weapon. Is it enough to use only standard tools? ThatÎÃÃs the real question. The abundance of excellent open-source libraries suggests otherwise. A skilled programmer crafts tools for themselves and their team. If your work feels tedious, perhaps itÎÃÃs time to build a bulldozer to tackle problems. Compile-time programming offers a way to build such tools. View the full article
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.