Implement comparison out of VariantData

This commit is contained in:
Benoit Blanchon
2022-04-07 21:37:00 +02:00
parent fc9d8aa31e
commit 3760a643cb
8 changed files with 37 additions and 63 deletions

View File

@@ -127,7 +127,19 @@ class ObjectConstRef : public ObjectRefBase<const CollectionData>,
}
FORCE_INLINE bool operator==(ObjectConstRef rhs) const {
return objectEquals(_data, rhs._data);
if (_data == rhs._data)
return true;
if (!_data || !rhs._data)
return false;
size_t count = 0;
for (iterator it = begin(); it != end(); ++it) {
if (it->value() != rhs[it->key()])
return false;
count++;
}
return count == rhs.size();
}
private:
@@ -215,7 +227,7 @@ class ObjectRef : public ObjectRefBase<CollectionData>,
}
FORCE_INLINE bool operator==(ObjectRef rhs) const {
return objectEquals(_data, rhs._data);
return ObjectConstRef(_data) == ObjectConstRef(rhs._data);
}
FORCE_INLINE void remove(iterator it) const {