5

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
bartop
  • 9,971
  • 1
  • 23
  • 54
  • 4
    [what-is-the-status-of-n2965-stdbases-and-stddirect-bases](https://stackoverflow.com/questions/18435001/what-is-the-status-of-n2965-stdbases-and-stddirect-bases) – Jarod42 Apr 21 '20 at 11:57
  • Pretty sure this can't be done with "stock" c++. Maybe when we get reflection. – NathanOliver Apr 21 '20 at 13:08

0 Answers0