| @@ -153,7 +153,7 @@ private: | |||||
| if (auto locked = ptr.lock()) | if (auto locked = ptr.lock()) | ||||
| return locked; | return locked; | ||||
| auto shared = std::make_shared<SharedObjectType>(); | |||||
| const std::shared_ptr<SharedObjectType> shared (new SharedObjectType()); | |||||
| ptr = shared; | ptr = shared; | ||||
| return shared; | return shared; | ||||
| } | } | ||||
| @@ -79,6 +79,18 @@ public: | |||||
| expect (SharedResourcePointer<Object>::getSharedObjectWithoutCreating() == std::nullopt); | expect (SharedResourcePointer<Object>::getSharedObjectWithoutCreating() == std::nullopt); | ||||
| } | } | ||||
| beginTest ("Create objects with private constructors"); | |||||
| { | |||||
| class ObjectWithPrivateConstructor | |||||
| { | |||||
| private: | |||||
| ObjectWithPrivateConstructor() = default; | |||||
| friend SharedResourcePointer<ObjectWithPrivateConstructor>; | |||||
| }; | |||||
| SharedResourcePointer<ObjectWithPrivateConstructor> instance; | |||||
| } | |||||
| } | } | ||||
| }; | }; | ||||