From 6f33639fbd17d2fbb3261fe9af0e7b30e55668a8 Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Mon, 12 Dec 2022 20:06:10 +0800 Subject: [PATCH] add noexcept Update safestl.h --- src/memory.h | 4 ++-- src/safestl.h | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/memory.h b/src/memory.h index 39eb7045..ac60d778 100644 --- a/src/memory.h +++ b/src/memory.h @@ -17,7 +17,7 @@ namespace pkpy{ shared_ptr(const shared_ptr& other) : counter(other.counter) { _inc_counter(); } - shared_ptr(shared_ptr&& other) : counter(other.counter) { + shared_ptr(shared_ptr&& other) noexcept : counter(other.counter) { other.counter = nullptr; } ~shared_ptr() { @@ -49,7 +49,7 @@ namespace pkpy{ return *this; } - shared_ptr& operator=(shared_ptr&& other) { + shared_ptr& operator=(shared_ptr&& other) noexcept { if (this != &other) { _dec_counter(); counter = other.counter; diff --git a/src/safestl.h b/src/safestl.h index 62c91cdc..778bb347 100644 --- a/src/safestl.h +++ b/src/safestl.h @@ -113,14 +113,14 @@ namespace pkpy { } } - ArgList(ArgList&& other){ + ArgList(ArgList&& other) noexcept { this->_args = other._args; this->_size = other._size; other._args = nullptr; other._size = 0; } - ArgList(PyVarList&& other){ + ArgList(PyVarList&& other) noexcept { __tryAlloc(other.size()); for(uint8_t i=0; i<_size; i++){ _args[i] = std::move(other[i]); @@ -147,7 +147,7 @@ namespace pkpy { } // overload = for && - ArgList& operator=(ArgList&& other){ + ArgList& operator=(ArgList&& other) noexcept { if(this != &other){ __tryRelease(); this->_args = other._args;