Browse Source

Added equal and not equal operators in Magnum::Resource

pull/346/head
Daniel Guzman 7 years ago
parent
commit
496127b59a
  1. 14
      src/Magnum/Resource.h

14
src/Magnum/Resource.h

@ -150,6 +150,12 @@ class Resource {
/** @brief Move assignment */
Resource<T, U>& operator=(Resource<T, U>&& other);
/** @brief Equal operator */
bool operator==(const Resource<T, U>& other) const;
/** @brief Not equal operator */
bool operator!=(const Resource<T, U>& other) const;
/** @brief Resource key */
ResourceKey key() const { return _key; }
@ -257,6 +263,14 @@ template<class T, class U> Resource<T, U>& Resource<T, U>::operator=(Resource<T,
return *this;
}
template<class T, class U> bool Resource<T, U>::operator==(const Resource<T, U>& other) const {
return manager == other.manager && _key == other._key;
}
template<class T, class U> bool Resource<T, U>::operator!=(const Resource<T, U>& other) const {
return !(*this == other);
}
template<class T, class U> void Resource<T, U>::acquire() {
/* The data are already final, nothing to do */
if(_state == ResourceState::Final) return;

Loading…
Cancel
Save