From 8ab1462402ad3797c18f3c78fe6f571830070231 Mon Sep 17 00:00:00 2001 From: Lynix Date: Sun, 22 Apr 2018 12:33:36 +0200 Subject: [PATCH] Core/HandledObject: Make move constructor/assignation operator noexception --- ChangeLog.md | 1 + include/Nazara/Core/HandledObject.hpp | 6 +++--- include/Nazara/Core/HandledObject.inl | 6 +++--- include/Nazara/Core/ObjectHandle.hpp | 4 ++-- include/Nazara/Core/ObjectHandle.inl | 4 ++-- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 27b762a17..8a71843c4 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -93,6 +93,7 @@ Nazara Engine: - Fixed SimpleTextDrawer line bounds - ⚠️ Stream::ReadLine will now returns empty lines if present in the file - Fixed cubemaps seams with OpenGL +- HandledObject movement constructor/assignement operator are now marked noexcept Nazara Development Kit: - Added ImageWidget (#139) diff --git a/include/Nazara/Core/HandledObject.hpp b/include/Nazara/Core/HandledObject.hpp index 4377377de..633f7e9fe 100644 --- a/include/Nazara/Core/HandledObject.hpp +++ b/include/Nazara/Core/HandledObject.hpp @@ -23,16 +23,16 @@ namespace Nz public: HandledObject() = default; HandledObject(const HandledObject& object); - HandledObject(HandledObject&& object); + HandledObject(HandledObject&& object) noexcept; ~HandledObject(); ObjectHandle CreateHandle(); HandledObject& operator=(const HandledObject& object); - HandledObject& operator=(HandledObject&& object); + HandledObject& operator=(HandledObject&& object) noexcept; protected: - void UnregisterAllHandles(); + void UnregisterAllHandles() noexcept; private: void RegisterHandle(ObjectHandle* handle); diff --git a/include/Nazara/Core/HandledObject.inl b/include/Nazara/Core/HandledObject.inl index 146e1fdd3..3349fa7e1 100644 --- a/include/Nazara/Core/HandledObject.inl +++ b/include/Nazara/Core/HandledObject.inl @@ -34,7 +34,7 @@ namespace Nz * \param object HandledObject to move into this */ template - HandledObject::HandledObject(HandledObject&& object) : + HandledObject::HandledObject(HandledObject&& object) noexcept : m_handles(std::move(object.m_handles)) { for (ObjectHandle* handle : m_handles) @@ -84,7 +84,7 @@ namespace Nz * \param object HandledObject to move in this */ template - HandledObject& HandledObject::operator=(HandledObject&& object) + HandledObject& HandledObject::operator=(HandledObject&& object) noexcept { UnregisterAllHandles(); @@ -112,7 +112,7 @@ namespace Nz * \brief Unregisters all handles */ template - void HandledObject::UnregisterAllHandles() + void HandledObject::UnregisterAllHandles() noexcept { // Tell every handle we got destroyed, to null them for (ObjectHandle* handle : m_handles) diff --git a/include/Nazara/Core/ObjectHandle.hpp b/include/Nazara/Core/ObjectHandle.hpp index 0527eb491..9dadbc832 100644 --- a/include/Nazara/Core/ObjectHandle.hpp +++ b/include/Nazara/Core/ObjectHandle.hpp @@ -49,8 +49,8 @@ namespace Nz static const ObjectHandle InvalidHandle; protected: - void OnObjectDestroyed(); - void OnObjectMoved(T* newObject); + void OnObjectDestroyed() noexcept; + void OnObjectMoved(T* newObject) noexcept; T* m_object; }; diff --git a/include/Nazara/Core/ObjectHandle.inl b/include/Nazara/Core/ObjectHandle.inl index f4c70ae85..f415f93de 100644 --- a/include/Nazara/Core/ObjectHandle.inl +++ b/include/Nazara/Core/ObjectHandle.inl @@ -268,7 +268,7 @@ namespace Nz * \brief Action to do on object destruction */ template - void ObjectHandle::OnObjectDestroyed() + void ObjectHandle::OnObjectDestroyed() noexcept { // Shortcut m_object = nullptr; @@ -278,7 +278,7 @@ namespace Nz * \brief Action to do on object move */ template - void ObjectHandle::OnObjectMoved(T* newObject) + void ObjectHandle::OnObjectMoved(T* newObject) noexcept { // The object has been moved, update our pointer m_object = newObject;