16
Jak wywołać :: std :: make_shared na klasie z tylko chronionymi lub prywatnymi konstruktorami?
Mam ten kod, który nie działa, ale myślę, że cel jest jasny: testmakeshared.cpp #include <memory> class A { public: static ::std::shared_ptr<A> create() { return ::std::make_shared<A>(); } protected: A() {} A(const A &) = delete; const A &operator =(const A &) = delete; }; ::std::shared_ptr<A> foo() { return A::create(); } Ale …
187
c++
c++11
shared-ptr