For some time this has been confusing me. And I've not been able to find a satisfactory answer thus far. The question is simple. When does a move assignment operator
get called, and when does a move constructor operator
get called?
The code examples on cppreference.com yield the following interesting results:
a2 = std::move(a1); // move-assignment from xvalue
A a2 = std::move(a1); // move-construct from xvalue
So has it do to with which is implemented? And if so which is executed if both are implemented? And why is there the possibility of creating a move assignment operator overload at all, if it's identical anyway.
Aucun commentaire:
Enregistrer un commentaire