mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-22 20:40:18 +00:00
add noexcept
Update safestl.h
This commit is contained in:
parent
e41a525f25
commit
6f33639fbd
@ -17,7 +17,7 @@ namespace pkpy{
|
|||||||
shared_ptr(const shared_ptr& other) : counter(other.counter) {
|
shared_ptr(const shared_ptr& other) : counter(other.counter) {
|
||||||
_inc_counter();
|
_inc_counter();
|
||||||
}
|
}
|
||||||
shared_ptr(shared_ptr&& other) : counter(other.counter) {
|
shared_ptr(shared_ptr&& other) noexcept : counter(other.counter) {
|
||||||
other.counter = nullptr;
|
other.counter = nullptr;
|
||||||
}
|
}
|
||||||
~shared_ptr() {
|
~shared_ptr() {
|
||||||
@ -49,7 +49,7 @@ namespace pkpy{
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
shared_ptr& operator=(shared_ptr&& other) {
|
shared_ptr& operator=(shared_ptr&& other) noexcept {
|
||||||
if (this != &other) {
|
if (this != &other) {
|
||||||
_dec_counter();
|
_dec_counter();
|
||||||
counter = other.counter;
|
counter = other.counter;
|
||||||
|
@ -113,14 +113,14 @@ namespace pkpy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ArgList(ArgList&& other){
|
ArgList(ArgList&& other) noexcept {
|
||||||
this->_args = other._args;
|
this->_args = other._args;
|
||||||
this->_size = other._size;
|
this->_size = other._size;
|
||||||
other._args = nullptr;
|
other._args = nullptr;
|
||||||
other._size = 0;
|
other._size = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ArgList(PyVarList&& other){
|
ArgList(PyVarList&& other) noexcept {
|
||||||
__tryAlloc(other.size());
|
__tryAlloc(other.size());
|
||||||
for(uint8_t i=0; i<_size; i++){
|
for(uint8_t i=0; i<_size; i++){
|
||||||
_args[i] = std::move(other[i]);
|
_args[i] = std::move(other[i]);
|
||||||
@ -147,7 +147,7 @@ namespace pkpy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// overload = for &&
|
// overload = for &&
|
||||||
ArgList& operator=(ArgList&& other){
|
ArgList& operator=(ArgList&& other) noexcept {
|
||||||
if(this != &other){
|
if(this != &other){
|
||||||
__tryRelease();
|
__tryRelease();
|
||||||
this->_args = other._args;
|
this->_args = other._args;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user