lundi 20 avril 2015

How to specialize a template function for enum, and specific type?

I currently have a function:

template<typename T> 
bool func(T &t, int x)
{
    // do stuff...
}

However I would like to have three different function bodies:

  1. T being an enum
  2. T being unsigned char
  3. Everything else

I have tried this already but didn't get far.

What are the correct function declarations for these three cases to work?

Aucun commentaire:

Enregistrer un commentaire