C++0x rvalue references and temporaries

后端 未结 6 2002
独厮守ぢ
独厮守ぢ 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条回答
  •  清歌不尽
    2021-02-02 00:24

    I did not see the behavior mentioned by Doug on g++. g++ 4.5 and 4.4.3 both call f(string &&) as expected but VS2010 calls f(const string &). Which g++ version are you using?

提交回复
热议问题