Boost logo

Boost Users :

Subject: Re: [Boost-users] shared_ptr design question
From: Igor R (boost.lists_at_[hidden])
Date: 2011-09-20 12:12:05

> Very much that, yes.
> shared_ptr<outer> o = make_shared<outer>();
> shared_ptr<inner> i = shared_ptr<inner>(o, &o->i);
> The aliasing ctor holds the second pointer argument, while using the
> refcounting of the first argument.
> There's no restriction that the pointer has to be to inside the object
> at all, but it tends to be the common use case.

Wow! I never payed attention to that ctor. Great feature.
I think it's worth to be highlighted somewhere in the docs.


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at