On Tue, Dec 20, 2011 at 5:23 PM, Igor R <boost.lists@gmail.com> wrote:
Please don't top-post.

> My case is like that: I have a number of polymorphic objects which can be
> used or referenced by other objects. I put them (the polymorphic objects) in
> MIC. And if one changes its type (not only its value), its users know it
> automatically by shared_ptr. I think I need MIC with shared_ptr pointing to
> scoped_ptr. Am I right? Or is there other way to easy handle it?

How can an object change its type?! In c++ type is a compile-type attribute.
Perhaps you mean that you erase an object from the container and add
another one, or replace some object. In any case, shared_ptr would be
fine.
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users

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<scoped_ptr<B>> 

But this type make my code hard to develop and also read.

Any good way? Thanks