C++0x rvalue references and temporaries

后端 未结 6 2075
独厮守ぢ
独厮守ぢ 2021-02-01 23:37

(I asked a variation of this question on comp.std.c++ but didn\'t get an answer.)

Why does the call to f(arg) in this code call the const ref overload of

6条回答
  •  Happy的楠姐
    2021-02-02 00:18

    Take a look at this:

    http://blogs.msdn.com/vcblog/archive/2009/02/03/rvalue-references-c-0x-features-in-vc10-part-2.aspx

    rvalue references: overload resolution

    It looks like your case is: "Lvalues strongly prefer binding to lvalue references".

提交回复
热议问题