samedi 26 décembre 2020

C++ Enum Templates

If we have an enumeration type:

enum E {
   E1,
   E2,
   ...
};

, and based on E, a template class:

template <E T>
class C {...};

Is there a way of using a declared variable of the type E as a template argument?

Example code:

...
E example_type = E1;
C example_class<example_type>;
...

Aucun commentaire:

Enregistrer un commentaire