vendredi 22 mars 2019

C++ possible to use move sematics to move data from one vector to another

The code below copies data from one vector into another. If the vectors are large then I guess this is expensive. Is it possible to use move semantics here to copy data from one vector into another?

std::vector<double> newData(Shape.Size(), 0);
std::vector<double> oldData = a->getData();
std::copy(oldData.begin(), oldData.end(), newData.begin());

Aucun commentaire:

Enregistrer un commentaire