While developing my own serialization library, I've found a need to
detect, for a given pair of classes B and D, such that D directly
derives from B, whether B is a virtual or non-virtual base of D. I've
tried a few approaches to developing a template that would be able to
resolve this, trying to use the inability to static_cast virtual bases
to derived classes, and conversion ambiguity in overrides with
covariant return types, but it seems that both approaches are dead-
ends - they aren't usable for SFINAE. And I can't figure out what
other quirks of the language can be used to detect virtual bases. In
fact, is it even possible to do? Perhaps someone could share his
experience in dealing with a similar problem?