That further simplifies everything, thankyou! :)

On 2 July 2011 20:29, Igor R <boost.lists@gmail.com> wrote:
> Hmm -- so I guess, in the cases I'm talking about, I should store a
> shared_ptr, and just return a const refererence.

Note that it might be rather dangerous, if your caller would store
such a const reference.


> Then, if I need to have a copy of the member elsewhere to manipulate, I
> could return a weak_ptr.

Returning weak_ptr usually doesn't make sense (except for the case
where you return it for tracking only). Note that shared_ptr is
implicitly convertible to weak_ptr, so typically you return
shared_ptr, and let the caller to decide what to do with it: if the
caller indends to store it, but doesn't want strong referencing, it
stores it as weak_ptr.
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users