2013/4/22 Vicente J. Botet Escriba
Out of curiosity, can you detect the difference? What can you do with
constexpr values that you can't with static const ones?
Even if most of the uses of integral_constant is to use its member ::value integral constant defines also the operator(), so it is a nullary functor.
integral_constant
a; constexpr int f(); template <int I> void g();
template <typename F> void h(F&& fct) { g
(); } h(&f); h(a); The last sentence will not compile if the operator() is not a constexpr and it can not be a constexpr if ::value is not a consexpr, or can it?
Really?? I thought a static constant can be used in constexpr functions, just like in C++03 it could be used as a non-type template parameter or static array size. Am I wrong here? Regards, Kris