
10 Dec
2005
10 Dec
'05
5:23 p.m.
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 :-) ).