|
Boost : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2005-12-10 12:23:48
Felipe Magno de Almeida wrote:
> struct A {};
> struct B {};
> struct C : B {};
>
> void foo(shared_ptr<A>);
> void foo(shared_ptr<B>);
>
> foo(new C());
>
> doesnt work because of A, that has nothing to do with A...
>
> IMHO, being able to do this is a must.
This is useful functionality, but the suggested "trivial implementation"
breaks shared_ptr/intrusive_ptr on all legacy compilers (easy to fix) and
carries the cost of including a type traits header (possible to fix if
someone cares to find the time to do it).
Note also that the above code is not required to work with tr1::shared_ptr
(not so easy to fix :-) ).
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk