mercredi 25 janvier 2017

C++ template specialization all types except one

I need a method(C++ 11) that is called for all types except one.

template<typename T>
void method(T& value)
{
...
}

template<>
void method(std::string& value)
{
...
}

Is it possible to do something like this? If not, is there other alternatives than using typeid at runtime?

Aucun commentaire:

Enregistrer un commentaire