RE: RE: [boost] Does anyone have an is_virtual_base_and_derived ?

8 Jul
2004
8 Jul
'04
5:04 p.m.
I wrote that very thing a year or so ago for the purpose of testing if a base pointer type can be statically downcast to a derived type.
My problem exactly !
I should warn you that this isn't quite enough information to test for static downcastability in all cases. Take the following example: struct b1 {}; struct b2 : b1 {}; struct b3 : virtual b2 {}; Here, b1 is not a virtual base of b3, but a downcast from b1* to b3* is still impossible. I don't believe there is any way to test for this case without compiler assistance. Testing for a virtual base happened to be good enough for us though, so we went with it; it may well be enough for your needs too.
7645
Age (days ago)
7645
Last active (days ago)
0 comments
1 participants
participants (1)
-
SRobb@reflectionsinteractive.com