diff --git a/src/ResourceManager.h b/src/ResourceManager.h index 2ff23433e..c355aeb86 100644 --- a/src/ResourceManager.h +++ b/src/ResourceManager.h @@ -270,6 +270,11 @@ template class Resource { if(manager) manager->incrementReferenceCount(key); } + /** @brief Move constructor */ + inline Resource(Resource&& other): manager(other.manager), key(other.key), lastCheck(other.lastCheck), _state(other._state), data(other.data) { + other.manager = nullptr; + } + /** @brief Destructor */ inline ~Resource() { if(manager) manager->decrementReferenceCount(key); @@ -289,6 +294,20 @@ template class Resource { return *this; } + /** @brief Assignment move operator */ + Resource& operator=(Resource&& other) { + if(manager) manager->decrementReferenceCount(key); + + manager = other.manager; + key = other.key; + lastCheck = other.lastCheck; + _state = other._state; + data = other.data; + + other.manager = nullptr; + return *this; + } + /** * @brief %Resource state *