lundi 1 mars 2021

How to detect if a type is one of a list of generic types

If I have

template <typename T> struct A;
template <typename T> struct B;
template <typename T> struct C;
template <typename T> struct D;

what is the most compact way of testing if some candidate type X is one of them? I'm looking for something like

boost::enable_if< is_instantiation_of_any<X,A,B,C,D> >

but A,B,C and D are templates so I'm not sure how to construct the above.

Aucun commentaire:

Enregistrer un commentaire