Fix ArrayMem & operator= (ArrayMem && a2)

This commit is contained in:
Matthias Hochsteger 2019-07-11 17:58:23 +02:00
parent 39e4e2bc12
commit 372b0a3089

View File

@ -1111,20 +1111,16 @@ namespace ngcore
} }
ArrayMem & operator= (ArrayMem && a2) ArrayMem & operator= (ArrayMem && a2)
{
if (a2.mem_to_delete)
{ {
ngcore::Swap (mem_to_delete, a2.mem_to_delete); ngcore::Swap (mem_to_delete, a2.mem_to_delete);
ngcore::Swap (data, a2.data);
ngcore::Swap (allocsize, a2.allocsize); ngcore::Swap (allocsize, a2.allocsize);
ngcore::Swap (size, a2.size); ngcore::Swap (size, a2.size);
} ngcore::Swap (data, a2.data);
else
{ if (mem_to_delete==nullptr)
allocsize = S; for (auto i : Range(size))
for (size_t i = 0; i < S; i++)
mem[i] = std::move(a2.mem[i]); mem[i] = std::move(a2.mem[i]);
}
return *this; return *this;
} }