move and rvalue

move

the move is a function to change a value to a type of rvalue.

rvalue reference

The value of variables with rvalue type are allowed to be modified using rvalue reference.
void p(int && a)
{
a=100;
}
int main()
{
p(100);
}

If you don't understand what happened, just print the address of a.

你可能感兴趣的:(move and rvalue)