Boost logo

Boost :

From: David Turner (dkturner_at_[hidden])
Date: 2004-03-04 10:24:51


Peter Dimov wrote:
> David Turner wrote:
>>
>>> Why is cast<> using a what looks like a homebrew RTTI system?
>>> Is there something that makes
>>> dynamic_pointer_cast<T::element_type>(w) inappropriate?
>>
>> Mm, er, um, ah... Yes, it is a homebrew RTTI system. It does nothing
>> that could not be achieved with dynamic_cast, but it's a bit less
>> weighty. By the way, the widget types already have names (the static
>> type() members) anyway, as a consequence of the use of window_base as
>> a factory. More on that below.
>
> I think that the important question here isn't "why doesn't cast<> use
> dynamic_cast<>", but "am I guaranteed to be able to use
> dynamic_pointer_cast<window::element_type>(w) to obtain a window given a
> widget w?"

I don't see any immediate reason why not. I'm not doing any nasties with
my homebrew system, it just checks if the widget is of the correct actual
type and then passes the correct interface by way of a void*.

Regards
David Turner


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