Boost logo

Boost :

Subject: Re: [boost] Downcast taking account of virtual inheritance
From: Robert Ramey (ramey_at_[hidden])
Date: 2010-02-14 17:28:08


Kim Barrett wrote:

> However, it seems to me that there is a bug in the existing
> smart_cast implementation, in that it may incorrectly attempt to use
> static_cast in the case where U is a virtual_base_of T.

smart_cast predates the existence of is_virtual_base_of by about 9 years
so I would expect this to be true.

> I think the correct fix is to leave the existing derivation test in
> place, but augment it with the is_virtual_base_of test, i.e. mpl::or_
> the existing test for cross-cast (T and U have no base/derived
> relationship) with the is_virtual_base_of test.

That would sound correct to me.

Robert Ramey


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