diff --git a/core/indigo-core/common/base_cpp/array.h b/core/indigo-core/common/base_cpp/array.h index bb83161e89..82f03552e0 100644 --- a/core/indigo-core/common/base_cpp/array.h +++ b/core/indigo-core/common/base_cpp/array.h @@ -44,11 +44,9 @@ namespace indigo { } - Array(Array&& other) : _reserved(other._reserved), _length(other._length), _array(other._array) + Array(Array&& other) noexcept : Array() { - other._array = nullptr; - other._length = 0; - other._reserved = 0; + swap(other); } ~Array() @@ -62,6 +60,12 @@ namespace indigo } } + Array& operator=(Array&& src) noexcept + { + swap(src); + return *this; + } + void clear() { _length = 0; @@ -358,7 +362,7 @@ namespace indigo _length = newsize; } - void swap(Array& other) + void swap(Array& other) noexcept { std::swap(_array, other._array); std::swap(_reserved, other._reserved);