From 2014650d5814022bc3c1277ccab849b6ea4b9ecc Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 30 Sep 2019 02:24:11 -0400 Subject: [PATCH] CToken: Mark CToken's move constructor noexcept The move constructor doesn't perform any behavior that would result in an exception being thrown. Marking it as noexcept allows the type to play nicely with facilities that make use of std::is_move_constructible to determine whether copies can be avoided or not in certain circumstances (e.g. the standard library; notably, std::vector). We can't mark the move assignment operator as noexcept currently, however, as it calls into interfaces outside of CToken. --- Runtime/CToken.cpp | 2 +- Runtime/CToken.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Runtime/CToken.cpp b/Runtime/CToken.cpp index d3cc11850..a9a47b681 100644 --- a/Runtime/CToken.cpp +++ b/Runtime/CToken.cpp @@ -128,7 +128,7 @@ CToken::CToken(const CToken& other) : x0_objRef(other.x0_objRef) { Lock(); } } -CToken::CToken(CToken&& other) : x0_objRef(other.x0_objRef), x4_lockHeld(other.x4_lockHeld) { +CToken::CToken(CToken&& other) noexcept : x0_objRef(other.x0_objRef), x4_lockHeld(other.x4_lockHeld) { other.x0_objRef = nullptr; other.x4_lockHeld = false; } diff --git a/Runtime/CToken.hpp b/Runtime/CToken.hpp index fc5ee6332..906786aa1 100644 --- a/Runtime/CToken.hpp +++ b/Runtime/CToken.hpp @@ -85,7 +85,7 @@ public: CToken& operator=(CToken&& other); CToken() = default; CToken(const CToken& other); - CToken(CToken&& other); + CToken(CToken&& other) noexcept; CToken(IObj* obj); CToken(std::unique_ptr&& obj); const SObjectTag* GetObjectTag() const;