diff options
Diffstat (limited to 'src/set.cpp')
-rw-r--r-- | src/set.cpp | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/set.cpp b/src/set.cpp index 001bce3..d224af3 100644 --- a/src/set.cpp +++ b/src/set.cpp @@ -32,7 +32,7 @@ SetBase::SetBase(shared_ptr<const Priv> p_): { } -shared_ptr<const SetBase::Priv> SetBase::add(Storage & st, const vector<Ref> & refs) const +shared_ptr<const SetBase::Priv> SetBase::add(const Storage & st, const vector<Ref> & refs) const { auto item = st.store(SetItem { .prev = p->items, @@ -122,6 +122,16 @@ vector<vector<Ref>> SetBase::toList() const return res; } +bool SetBase::operator==(const SetBase & other) const +{ + return p->items == other.p->items; +} + +bool SetBase::operator!=(const SetBase & other) const +{ + return !(*this == other); +} + vector<Digest> SetBase::digests() const { vector<Digest> res; @@ -131,6 +141,15 @@ vector<Digest> SetBase::digests() const return res; } +vector<Ref> SetBase::store() const +{ + vector<Ref> res; + res.reserve(p->items.size()); + for (const auto & i : p->items) + res.push_back(i.ref()); + return res; +} + SetItem SetItem::load(const Ref & ref) { if (auto rec = ref->asRecord()) { |