4

It's kind of like std::is_empty but allows virtual functions, and the class may also have multiple base classes. This is the hard part. When the class has none or only one base, I can check std::is_polymorphic and compare its size with an empty polymorphic class. I have no clue how to do it when it has multiple empty polymorphic base classes.

cigien
  • 57,834
  • 11
  • 73
  • 112
W.H
  • 1,838
  • 10
  • 24
  • You might want to link to this [question](https://stackoverflow.com/questions/4828992) as it covers a lot of the potential solutions for this question. You should also take a look at it if you haven't already. – cigien Mar 28 '21 at 15:14
  • What goes wrong with the multiple base case? Can you show code? – Yakk - Adam Nevraumont Mar 28 '21 at 17:53
  • @Yakk-AdamNevraumont `struct A { virtual ~A() = default; };` `struct B { virtual ~B() = default; };` `struct C : public A, public B {};` Both B and C match the requirement but they may have different size – W.H Mar 28 '21 at 22:08
  • 1
    Please add all relevant details to the question, not as comments. – cigien Mar 28 '21 at 22:14

0 Answers0