diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-08-06 12:12:00 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-08-06 12:12:00 +0100 |
commit | 1aa38a090e9de24c8a5ea8e12c6601d66fa6e2d7 (patch) | |
tree | 4d63670b9299627798c1d704f5ff61265b038d32 | |
parent | ModelPartForDictionary<T>::OnEachChild creates pair MP on stack (diff) | |
download | slicer-1aa38a090e9de24c8a5ea8e12c6601d66fa6e2d7.tar.bz2 slicer-1aa38a090e9de24c8a5ea8e12c6601d66fa6e2d7.tar.xz slicer-1aa38a090e9de24c8a5ea8e12c6601d66fa6e2d7.zip |
[De]serializeAny[With] uses unique_ptr
-rw-r--r-- | slicer/slicer/slicer.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/slicer/slicer/slicer.h b/slicer/slicer/slicer.h index ce7e037..5450722 100644 --- a/slicer/slicer/slicer.h +++ b/slicer/slicer/slicer.h @@ -8,7 +8,7 @@ namespace Slicer { template<typename Object> Object - DeserializeAnyWith(const DeserializerPtr & deserializer) + DeserializeAnyWith(any_ptr<Deserializer> deserializer) { Object object {}; deserializer->Deserialize(ModelPart::CreateRootFor<Object>(object)); @@ -19,12 +19,12 @@ namespace Slicer { Object DeserializeAny(SerializerParams &&... sp) { - return DeserializeAnyWith<Object>(std::make_shared<Deserializer>(std::forward<SerializerParams>(sp)...)); + return DeserializeAnyWith<Object>(std::make_unique<Deserializer>(std::forward<SerializerParams>(sp)...)); } template<typename Object> void - SerializeAnyWith(const Object & object, const SerializerPtr & serializer) + SerializeAnyWith(const Object & object, any_ptr<Serializer> serializer) { serializer->Serialize(ModelPart::CreateRootFor<const Object>(object)); } @@ -33,7 +33,7 @@ namespace Slicer { void SerializeAny(const Object & object, SerializerParams &&... sp) { - SerializeAnyWith(object, std::make_shared<Serializer>(std::forward<SerializerParams>(sp)...)); + SerializeAnyWith(object, std::make_unique<Serializer>(std::forward<SerializerParams>(sp)...)); } } |