|
Boost : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2001-07-24 08:04:17
From: <greg_at_[hidden]>
> This looks like a good start, thanks. I think do_dynamic_cast is the
> name we previously agreed on for your shared_dynamic_cast, and that
> we wanted a version that worked for raw pointers as well.
If do_dynamic_cast is supposed to be a generalization of dynamic_cast:
template<class R, class T> R do_dynamic_cast(T /* const */ &);
(dynamic_cast<U*> returns U*, dynamic_cast<U&> returns U&)
then dynamic-casting a shared_ptr would look like
do_dynamic_cast<shared_ptr<X> >(y); // 1
whereas with a shared_ptr-specific cast the syntax would be
shared_dynamic_cast<X>(y); // 2
I prefer (2). (1) is more generic but I can't see how the genericity would
be exploited.
-- Peter Dimov Multi Media Ltd.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk