Demo
A in class declaration of A::foo.
struct A {
template
void foo(T a);
};
A::foo is now split by sfi
One way to achieve this is to internally tag-dispatch:
#include
#include
struct A {
template
void foo(T a);
private:
template
auto implement_foo(T value, std::true_type) -> void;
template
auto implement_foo(T value, std::false_type) -> void;
};
template
void A::foo(T a ) {
implement_foo(a, std::integral_constant4)>());
}
template
auto A::implement_foo(T value, std::true_type) -> void
{
std::cout << "> 4 \n";
}
template
auto A::implement_foo(T value, std::false_type) -> void
{
std::cout << "not > 4 \n";
}
main()
{
A a;
a.foo(char(1));
a.foo(double(1));
}