From 07e61f5e729884f8bdc19cf213c919ea6a98369c Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 20 Aug 2023 01:52:30 +0100 Subject: Create Optional ModelParts as unique_ptrs --- slicer/slicer/modelParts.h | 1 + slicer/slicer/modelPartsTypes.h | 2 +- slicer/slicer/modelPartsTypes.impl.h | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/slicer/slicer/modelParts.h b/slicer/slicer/modelParts.h index 39149fd..f521257 100644 --- a/slicer/slicer/modelParts.h +++ b/slicer/slicer/modelParts.h @@ -79,6 +79,7 @@ namespace Slicer { class HookCommon; using ModelPartPtr = std::shared_ptr; + using ModelPartUPtr = std::unique_ptr; using ModelPartForRootPtr = std::unique_ptr; using ModelPartParam = any_ptr; using ModelPartForRootParam = any_ptr; diff --git a/slicer/slicer/modelPartsTypes.h b/slicer/slicer/modelPartsTypes.h index ab262f3..838bbd0 100644 --- a/slicer/slicer/modelPartsTypes.h +++ b/slicer/slicer/modelPartsTypes.h @@ -113,7 +113,7 @@ namespace Slicer { protected: virtual bool hasModel() const = 0; - ModelPartPtr modelPart; + ModelPartUPtr modelPart; }; template diff --git a/slicer/slicer/modelPartsTypes.impl.h b/slicer/slicer/modelPartsTypes.impl.h index 7884a02..3a4076e 100644 --- a/slicer/slicer/modelPartsTypes.impl.h +++ b/slicer/slicer/modelPartsTypes.impl.h @@ -300,7 +300,7 @@ namespace Slicer { ModelPartModel>(h) { if (this->Model && *this->Model) { - modelPart = std::make_shared(&**this->Model); + modelPart = std::make_unique(&**this->Model); } } @@ -319,7 +319,7 @@ namespace Slicer { BOOST_ASSERT(this->Model); if (!*this->Model) { *this->Model = typename T::element_type(); - modelPart = std::make_shared(&**this->Model); + modelPart = std::make_unique(&**this->Model); modelPart->Create(); } } -- cgit v1.2.3