3 ms·
if this is a C++17 library why couldn't you use `constexpr` evaluation and not murder your compilation time?
by jjmarr 8mo ago
if this is a C++17 library why couldn't you use `constexpr` evaluation and not murder your compilation time?
- pjmlp 8mo agoI imagine because some of the cool constexpr improvements are only available in C++20 and C++23.
- mistivia 8mo agoTemplate metaprogramming isn't really suited for this task, the prime sieve here serves only as a proof of concept, meant to show the capabilities of this style. But there are cases where `constexpr` is not applicable, especially when involving type manipulations. On the other hand, C++ template metaprogramming, as an esolang, is fun to tame and experiment with.
- jjmarr 8mo agoIs there a clearer example where constexpr wouldn't work? > On the other hand, C++ template metaprogramming, as an esolang, is fun to tame and experiment with. Is it an esolang at this point? I feel old.
- ahartmetz 8mo agoAlways has been (I'm over 40). It used to be a nightmare of a programming language, now with all the improvements over time it's merely quite bad. Its power to weight ratio is below any reasonable standard, but sometimes you need the power. Some lunatics like to play with it.
- mistivia 8mo agoI've add exmaples of a toy EDSL and compile-time reflex in C++17 in GitHub readme, which wouldn't work with constexpr only.