From b76e12480cd3be004a5c73040513d2f67cbf297f Mon Sep 17 00:00:00 2001 From: Luna Date: Wed, 9 Oct 2024 11:27:52 +0200 Subject: [PATCH] Add opPostMove to vector --- source/numem/collections/vector.d | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/source/numem/collections/vector.d b/source/numem/collections/vector.d index 19da3e5..fd39985 100644 --- a/source/numem/collections/vector.d +++ b/source/numem/collections/vector.d @@ -546,6 +546,18 @@ public: this._memcpy(cast(T*)slice.ptr, cast(T*)values.ptr, slice.length); } + + /** + Handle struct moves. + */ + @trusted + void opPostMove(ref typeof(this) old) nothrow { + if (old.memory) { + this.memory = cast(valueType*)old.memory; + this.size_ = old.size_; + this.capacity_ = old.capacity_; + } + } } /**