
4 Mar
2004
4 Mar
'04
1:45 p.m.
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?"