#include <iostream>
void print(int&& value) {
std::cout << value << std::endl;
}
int main() {
int value = 20;
print(std::move(value));
value = 15;
std::cout << value << std::endl;
return 0;
}
I'm trying to get my head around some of the fundamentals of move semantics.
In the case of the code above, my understanding is that std::move has "attempted" to perform a move on value.
Is any attempt to use it after this undefined? Or is something more complex going on, potentially silently degrading performance?
Aucun commentaire:
Enregistrer un commentaire