dimanche 22 avril 2018

Is it possible to make a template that can only take specific types?

I was wondering if it was possible for a template (or any other tool you might recommend)to only take a type from a list of specific types (like an enum, but with already existing types). More specifically, if I have 3 classes, class A, class B and class C, and I'd like a function to be able to take any of those three classes as argument (but no other class than the 3), what should I do ? Should I use a template (if so how should I use it), or are there other tools for me to use ?

Aucun commentaire:

Enregistrer un commentaire