When you have a vector
and you assign the vector
to another vector
, elements are copied 1 by 1 and you get two identical copies.
When you move assign a vector
to another vector
, the entire internal array is pilfered at once. Elements are not moved 1 by 1.
When you move assign an std::array
to another std::array
elements are moved 1 by 1 to the new array.
Why std::array
does not do what vector does, pilfer the entire internal array at once instead of moving elements 1 by 1?
Aucun commentaire:
Enregistrer un commentaire