summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/erebos/storage.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/include/erebos/storage.h b/include/erebos/storage.h
index 57304e1..34ed9df 100644
--- a/include/erebos/storage.h
+++ b/include/erebos/storage.h
@@ -168,10 +168,13 @@ public:
Ref & operator=(const Ref &) = default;
Ref & operator=(Ref &&) = default;
+ bool operator==(const Ref &) = delete;
+ bool operator!=(const Ref &) = delete;
+
static std::optional<Ref> create(Storage, const Digest &);
static Ref zcreate(Storage);
- constexpr operator bool() const { return true; }
+ explicit constexpr operator bool() const { return true; }
const Object operator*() const;
std::unique_ptr<Object> operator->() const;
@@ -523,12 +526,12 @@ template<typename T>
std::optional<Head<T>> Head<T>::update(const std::function<Stored<T>(const Stored<T> &)> & f) const
{
auto res = Storage::updateHead(T::headTypeId, mid, ref(), [&f, this](const Ref & r) {
- return f(r == ref() ? stored() : Stored<T>::load(r)).ref();
+ return f(r.digest() == ref().digest() ? stored() : Stored<T>::load(r)).ref();
});
if (!res)
return std::nullopt;
- if (*res == ref())
+ if (res->digest() == ref().digest())
return *this;
return Head<T>(mid, *res);
}