@[TOC](当构造函数是pretected 或者是private的时候,如何在使用std:make_shared())
参考链接
https://inneka.com/programming/cpp/how-do-i-call-stdmake_shared-on-a-class-with-only-protected-or-private-constructors/
最简单的方法
class A
{
public:
static std::shared_ptr create()
{
struct make_shared_enabler : public A {};
return std::make_shared<make_shared_enabler>();
}
private:
A() {}
};