C ++ 11 allows you to (reliably) use enable_if-style SFINAE in template arguments:
template<
bool B = has_default_ctr
, typename std::enable_if<B, int>::type = 0
>
MyClass();
template<bool B, typename std::enable_if<B, int>::type = 0>
MyClass::MyClass()
In C ++ 03, you could use a unary constructor with a default parameter - the default parameter means that the constructor is still considered the default constructor.
source
share