I read a code snippet just now:
template<class T>
struct HasHelloWorld
{
typedef char(&yes)[1];
typedef char(&no)[2];
template <typename C> static yes check(decltype(&C::HelloWorld));
template <typename> static no check(...);
static constexpr bool value = sizeof(check<T>(0)) == sizeof(yes);
};
Is this because when sizeof
accepts an evaluation, the evaluation doesn't get calculated?