does sfinae instantiates a function body?
问题 I want to detect existence of a specific member function for a class, using the usual SFINAE trick. template<typename T> struct has_alloc { template<typename U,U x> struct dummy; template<typename U> static char test(dummy<void* (U::*)(std::size_t),&U::allocate>*); template<typename U> static char (&test(...))[2]; static bool const value = sizeof(test<T>(0)) ==1; }; It should be noted that this detects a different kind of allocator which has void* allocate(std::size_t) as member function