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

@ -1112,19 +1112,15 @@ namespace ngcore
ArrayMem & operator= (ArrayMem && a2)
{
if (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 (size, a2.size);
}
else
{
allocsize = S;
for (size_t i = 0; i < S; i++)
mem[i] = std::move(a2.mem[i]);
}
ngcore::Swap (mem_to_delete, a2.mem_to_delete);
ngcore::Swap (allocsize, a2.allocsize);
ngcore::Swap (size, a2.size);
ngcore::Swap (data, a2.data);
if (mem_to_delete==nullptr)
for (auto i : Range(size))
mem[i] = std::move(a2.mem[i]);
return *this;
}