
20 Dec
2011
20 Dec
'11
11:01 p.m.
What I mean is dynamic changing. For example
class B {public: virtual ~B()} // Base class. class D1 : public B {} // D1 derived from B class D2 : public B {} // D1 derived from B
scoped_ptr<B> p = new D1; // pointing to D1 p.reset(new D2); // change pointing to D2
If they are shared between owners and users, I need type
shared_ptr
But this type make my code hard to develop and also read.
And what's wrong with just shared_ptr<B>? Why do you need the additional level of indirection?