From f91e2ea8d9e30b1e62c4f8784fddfd4eb9578d2d Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Tue, 21 Feb 2023 20:09:41 +0000 Subject: Move Appender in Persistence NS and simplify types --- lib/persistence.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'lib') diff --git a/lib/persistence.h b/lib/persistence.h index d55062a..5c8454c 100644 --- a/lib/persistence.h +++ b/lib/persistence.h @@ -273,6 +273,22 @@ namespace Persistence { Map & map; }; + template + struct Appender : public Persistence::SelectionT { + Appender(Container & c) : Persistence::SelectionT {s}, container {c} { } + using Persistence::SelectionT::SelectionT; + void + endObject(Persistence::Stack & stk) override + { + container.emplace_back(std::move(s)); + stk.pop(); + } + + private: + Type s; + Container & container; + }; + struct Persistable { Persistable() = default; virtual ~Persistable() = default; -- cgit v1.2.3