I have this code that doesn\'t work, but I think the intent is clear:
testmakeshared.cpp
#include
class A {
public:
stat
Here's a neat solution for this:
#include
class A {
public:
static shared_ptr Create();
private:
A() {}
struct MakeSharedEnabler;
};
struct A::MakeSharedEnabler : public A {
MakeSharedEnabler() : A() {
}
};
shared_ptr A::Create() {
return make_shared();
}