diff options
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenlib/BLI_virtual_array.hh | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_virtual_array.hh b/source/blender/blenlib/BLI_virtual_array.hh index 0705d423f01..8f228ea188e 100644 --- a/source/blender/blenlib/BLI_virtual_array.hh +++ b/source/blender/blenlib/BLI_virtual_array.hh @@ -1153,6 +1153,30 @@ template<typename T> class VArray_Span final : public Span<T> { this->data_ = owned_data_.data(); } } + + VArray_Span(VArray_Span &&other) + : varray_(std::move(other.varray_)), owned_data_(std::move(other.owned_data_)) + { + this->size_ = varray_.size(); + if (varray_.is_span()) { + this->data_ = varray_.get_internal_span().data(); + } + else { + this->data_ = owned_data_.data(); + } + other.data_ = nullptr; + other.size_ = 0; + } + + VArray_Span &operator=(VArray_Span &&other) + { + if (this == &other) { + return *this; + } + std::destroy_at(this); + new (this) VArray_Span(std::move(other)); + return *this; + } }; /** |