
10 Feb
2003
10 Feb
'03
10:03 p.m.
Hi, in C++ it's possible to write this: class A {}; class B: public A {}; class X { virtual A* f() { ... }; }; class Y: public X { virtual B* f() { ... }; // B* is covariant from A* }; However it is NOT possible to write that with shared_ptr: class X { shared_ptr<A> f() { ... }; }; class Y: public X { virtual shared_ptr<B> f() { ... }; // Error: shared_ptr<B> is NOT covariant from shared_ptr<A> }; I don't know C++ standard very well (in fact I've never read it). So my question is: it's possible to adjust shared_ptr to allow such constructions? Thank you, Wasek [Non-text portions of this message have been removed]