Boost logo

Boost :

From: Robert Ramey (ramey_at_[hidden])
Date: 2004-07-08 16:12:24


I'm beginning to see that now. In my test case the situation has been much
confused by the fact that b1 has/didn't have a virtual destructor which in
turn makes it possible/impossible. Oh and running on different compilers in
debug/release mode changed behavior as well which left me totally confused.
So I'm working through my confusion.

>> > 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.

Robert Ramey


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk