Subject: [Boost-bugs] [Boost C++ Libraries] #2481: make_shared and allocate_shared friendship
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2008-11-06 18:38:41
#2481: make_shared and allocate_shared friendship
----------------------------------------------------+-----------------------
Reporter: Michael Marcin <mike.marcin_at_[hidden]> | Owner: pdimov
Type: Feature Requests | Status: new
Milestone: Boost 1.38.0 | Component: smart_ptr
Version: Boost 1.36.0 | Severity: Problem
Keywords: |
----------------------------------------------------+-----------------------
It is currently vary difficult to have a class with private constructors
use make_shared and allocate_shared. This same classes are some ideal
candidates for private constructors because any class that derives from
enable_shared_from_this should probably have private constructors to
prevent misuse. Simplifying friend declarations for these functions would
be very helpful.
For example:
{{{
#!cpp
class Foo : public enable_shared_from_this<Foo>
{
friend class make_shared_access;
Foo();
};
int main()
{
shared_ptr<Foo> foo( make_shared<Foo>() );
}
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/2481> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:59 UTC