Quick A: each release of C++ allows more things to be done at compile time.
Recently on SO:
Compile-time loop optimisation
In C++14, constexpr function requirements were relaxed.
Previously, in C++11, constexpr functions could only contain typedefs, static_asserts and usings, but only a single return statement.
In C++14, it became possible to use loops in constexpr function bodies.
Because b was declared as constexpr char, it must be evaluated at compile time. The compiler then optimised out the isStringNice function, as it is not used at run time.
Add a Comment
Comments are closed.