If I have a class with a private construction, using boost::make_shared()
to construct a shared_ptr
of that class from within a member function of that class will issue a compiler error using gcc 4.6.
#include "boost/shared_ptr.hpp"
#include "boost/make_shared.hpp"
class Foo
{
private:
Foo(int a){};
public:
static boost::shared_ptr<Foo> do_foo(){ return boost::make_shared<Foo>(5); }
friend template boost::shared_ptr<Foo> boost::make_shared<Foo>( Arg1 && arg1, Args && ... args );
}
int main()
{
auto f = Foo::do_foo();
}
A call to Foo::do_foo
will result in a compiler error.
Any thoughts?