From 496127b59aafdb3e50684d73a549219fcfb7a872 Mon Sep 17 00:00:00 2001 From: Daniel Guzman Date: Tue, 4 Jun 2019 22:56:16 +0200 Subject: [PATCH] Added equal and not equal operators in Magnum::Resource --- src/Magnum/Resource.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Magnum/Resource.h b/src/Magnum/Resource.h index e5cbae549..04913c363 100644 --- a/src/Magnum/Resource.h +++ b/src/Magnum/Resource.h @@ -150,6 +150,12 @@ class Resource { /** @brief Move assignment */ Resource& operator=(Resource&& other); + /** @brief Equal operator */ + bool operator==(const Resource& other) const; + + /** @brief Not equal operator */ + bool operator!=(const Resource& other) const; + /** @brief Resource key */ ResourceKey key() const { return _key; } @@ -257,6 +263,14 @@ template Resource& Resource::operator=(Resource bool Resource::operator==(const Resource& other) const { + return manager == other.manager && _key == other._key; +} + +template bool Resource::operator!=(const Resource& other) const { + return !(*this == other); +} + template void Resource::acquire() { /* The data are already final, nothing to do */ if(_state == ResourceState::Final) return;