美文网首页
move and rvalue

move and rvalue

作者: solk1234 | 来源:发表于2019-07-10 23:16 被阅读0次

    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

          本文链接:https://www.haomeiwen.com/subject/ecklkctx.html