From 54c6122cbd1f030f83b6a8079cc538ba6d9c390f Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 27 Mar 2020 20:56:01 -0400 Subject: [PATCH 1/2] CToken: Mark move assignment operator as noexcept Allows containers and anything using std::move_if_noexcept to perform a move instead of a copy. --- 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 e30daf34f..38bfa24ed 100644 --- a/Runtime/CToken.cpp +++ b/Runtime/CToken.cpp @@ -112,7 +112,7 @@ CToken& CToken::operator=(const CToken& other) { } return *this; } -CToken& CToken::operator=(CToken&& other) { +CToken& CToken::operator=(CToken&& other) noexcept { Unlock(); RemoveRef(); x0_objRef = other.x0_objRef; diff --git a/Runtime/CToken.hpp b/Runtime/CToken.hpp index ba8722d2b..4cbd9ba5b 100644 --- a/Runtime/CToken.hpp +++ b/Runtime/CToken.hpp @@ -84,7 +84,7 @@ public: IObj* GetObj(); const IObj* GetObj() const { return const_cast(this)->GetObj(); } CToken& operator=(const CToken& other); - CToken& operator=(CToken&& other); + CToken& operator=(CToken&& other) noexcept; CToken() = default; CToken(const CToken& other); CToken(CToken&& other) noexcept; From 764dac0adcdcdec4913ada3ae6ac6370f8d24fd7 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 28 Mar 2020 05:55:17 -0400 Subject: [PATCH 2/2] CToken: Add missing override specifiers --- Runtime/CToken.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Runtime/CToken.hpp b/Runtime/CToken.hpp index 4cbd9ba5b..18b37779c 100644 --- a/Runtime/CToken.hpp +++ b/Runtime/CToken.hpp @@ -153,7 +153,7 @@ public: m_obj = nullptr; return *this; } - TCachedToken& operator=(const CToken& other) { + TCachedToken& operator=(const CToken& other) override { TToken::operator=(other); m_obj = nullptr; return *this; @@ -172,7 +172,7 @@ public: return *this; } TLockedToken(const CToken& other) : TCachedToken(other) { CToken::Lock(); } - TLockedToken& operator=(const CToken& other) { + TLockedToken& operator=(const CToken& other) override { CToken oldTok = std::move(*this); TCachedToken::operator=(other); CToken::Lock();