mardi 21 avril 2020

Trait to get base class(es) of given class in compile time

In cpp I can easily check if class A is subclass of B like that:

class B{};
class A : public B {};

is_base_of_v<B, A>

But is there a way to do something like this?

class B{};
class C{};
class A : public B, public C {};

using bases  = base_classes<A>; //giving tuple<B, C> or something like that

Aucun commentaire:

Enregistrer un commentaire