- give TMap a proper move constructor and assignment operator.

This commit is contained in:
Christoph Oelckers 2021-08-21 10:32:20 +02:00
parent e74e581637
commit 6d958135e0

View file

@ -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