Skip to content

Monthly Archives: December 2023

is_constexpr – a template to test if a function is constexpr

C++ allows declaring functions as constexpr. Such functions could be evaluated at compile time and used, for example in if constexpr(...). However, a non-constexpr function in this context is not allowed. So, if we want to write a template, accepting a function and using it in either if constexpr(...) or old plain if(...) we need […]