move and rvalue

2019-07-10  本文已影响0人  solk1234

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.

上一篇下一篇

猜你喜欢

热点阅读