A in class declaration of A::foo.
struct A {
template <typename T>
void foo(T a);
};
A::foo is now split by sfinae.
template <typename T>
typename std::enable_if<(sizeof(T) > 4), void>::type A::foo(T a ) {
std::cout << "> 4 \n";
}
This doesn't work. Is this not allowed?
The return type in the declaration must match the definition.
SFINAE cannot be encapsulated as an implementation detail.
(demo)
One way to achieve this is to internally tag-dispatch: