diff options
Diffstat (limited to 'lib/persistence.h')
-rw-r--r-- | lib/persistence.h | 12 |
1 files changed, 6 insertions, 6 deletions
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<typename Map, typename Type = typename Map::mapped_type, auto Key = &Type::id> - struct MapByMember : public Persistence::SelectionT<std::shared_ptr<Type>> { - MapByMember(Map & m) : Persistence::SelectionT<std::shared_ptr<Type>> {s}, map {m} { } + template<typename Map, typename Type = typename Map::mapped_type, auto Key = &Type::element_type::id> + struct MapByMember : public Persistence::SelectionT<Type> { + MapByMember(Map & m) : Persistence::SelectionT<Type> {s}, map {m} { } - using Persistence::SelectionT<std::shared_ptr<Type>>::SelectionT; + using Persistence::SelectionT<Type>::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<Type> s; + Type s; Map & map; }; |