Detecting constexpr with SFINAE
I'm working on upgrading some C++ code to take advantage of the new functionality in C++11. I have a trait class with a few functions returning fundamental types which would most of the time, but not always, return a constant expression. I would like to do different things based on whether the function is constexpr or not. I came up with the following approach: template<typename Trait> struct test { template<int Value = Trait::f()> static std::true_type do_call(int){ return std::true_type(); } static std::false_type do_call(...){ return std::false_type(); } static bool call(){ return do_call(0