Boost logo

Boost :

Subject: Re: [boost] [shared_ptr] Design question about make_shared
From: Lars Viklund (zao_at_[hidden])
Date: 2011-06-15 07:01:31


On Wed, Jun 15, 2011 at 10:35:05AM +0000, Stephan T. Lavavej wrote:
> [STL]
> > Actually, make_shared<T>() needs access to shared_ptr's guts, at least if the
> > implementer takes advantage of the obvious and highly desirable optimization.
> > They are tightly coupled to begin with.
>
> [Emil Dotchevski]
> > However, the coupling between make_shared and shared_ptr is an
> > implementation detail.
>
> Right, that's what I was trying to say - internally, they are coupled, yet make_shared goes out of its way to be a free function.

Notable in general is that free functions can be forward declared on
their own, but to declare and use a static member function, you need to
have the class definition present.

-- 
Lars Viklund | zao_at_[hidden]

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk