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.
This commit is contained in:
Lioncash 2019-09-30 02:24:11 -04:00
parent 79ac5d76df
commit 2014650d58
2 changed files with 2 additions and 2 deletions

View File

@ -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;
}

View File

@ -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<IObj>&& obj);
const SObjectTag* GetObjectTag() const;