using SFINAE for template class specialisation

IF the original declaration of User<> can be adapted to

template<typename, typename=std::true_type> class User;

then we can find a solution (following Luc Danton’s comment, instead of using std::enable_if)

template<typename>
struct is_Data : std::false_type {};
template<typename T>
struct is_Data<Data<T>> : std::true_type {};

template<typename T>
class User<T, typename is_Data<T>::type >
{ /* ... */ };

However, this doesn’t answer the original question, since it requires to change the original definition of User. I’m still waiting for a better answer. This could be one that conclusively demonstrates that no other solution is possible.

Leave a Comment