remove memcpy on simple_temporary_data.h

This commit is contained in:
alemuntoni 2021-10-19 15:46:14 +02:00
parent 9353836106
commit 9dccb764ed
1 changed files with 16 additions and 12 deletions

View File

@ -66,18 +66,22 @@ public:
delete[] booldata;
}
void reserve(size_t sz)
{
if (sz <= datareserve)
return;
bool *newdataLoc = new bool[sz];
if (datasize != 0)
memcpy(newdataLoc, booldata, sizeof(bool) * sizeof(datasize));
std::swap(booldata, newdataLoc);
if (newdataLoc != 0)
delete[] newdataLoc;
datareserve = sz;
}
void reserve(size_t sz)
{
if (sz <= datareserve)
return;
bool* newdataLoc = new bool[sz];
if (datasize != 0) {
// memcpy(newdataLoc, booldata, sizeof(bool) * sizeof(datasize));
for (unsigned int i = 0; i < datasize; ++i)
newdataLoc[i] = booldata[i];
}
std::swap(booldata, newdataLoc);
if (newdataLoc != 0)
delete[] newdataLoc;
datareserve = sz;
}
void resize(size_t sz)
{