From 6d958135e04992c05c22c9e8b8abb38a173cb571 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 21 Aug 2021 10:32:20 +0200 Subject: [PATCH] - give TMap a proper move constructor and assignment operator. --- source/common/utility/tarray.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/source/common/utility/tarray.h b/source/common/utility/tarray.h index 2aaf5c0cf..4a9e7388b 100644 --- a/source/common/utility/tarray.h +++ b/source/common/utility/tarray.h @@ -837,6 +837,18 @@ public: CopyNodes(o.Nodes, o.Size); } + TMap(TMap &&o) + { + Nodes = o.Nodes; + LastFree = o.LastFree; /* any free position is before this position */ + Size = o.Size; /* must be a power of 2 */ + NumUsed = o.NumUsed; + + o.Size = 0; + o.NumUsed = 0; + o.SetNodeVector(1); + } + TMap &operator= (const TMap &o) { NumUsed = 0; @@ -846,6 +858,12 @@ public: return *this; } + TMap &operator= (TMap &&o) + { + TransferFrom(o); + return *this; + } + //======================================================================= // // TransferFrom