From 320e5cc574f0c8f83def034e36f6d0c57b1f75ac Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Wed, 22 Feb 2023 20:54:39 +0000 Subject: Fixup MapByMember to work with shared or unique ptr --- lib/persistence.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'lib/persistence.h') diff --git a/lib/persistence.h b/lib/persistence.h index 5c8454c..0fc0200 100644 --- a/lib/persistence.h +++ b/lib/persistence.h @@ -256,20 +256,20 @@ namespace Persistence { } }; - template - struct MapByMember : public Persistence::SelectionT> { - MapByMember(Map & m) : Persistence::SelectionT> {s}, map {m} { } + template + struct MapByMember : public Persistence::SelectionT { + MapByMember(Map & m) : Persistence::SelectionT {s}, map {m} { } - using Persistence::SelectionT>::SelectionT; + using Persistence::SelectionT::SelectionT; void endObject(Persistence::Stack & stk) override { - map.emplace(std::invoke(Key, s), s); + map.emplace(std::invoke(Key, s), std::move(s)); stk.pop(); } private: - std::shared_ptr s; + Type s; Map & map; }; -- cgit v1.2.3