在C++11中,值参数(和其他值)在返回时享受隐式移动: return a; // uses A::A(A&&) if it exists至少在MSVC2010中,右值引用参数需要std::move return a; // uses A::A(A const&) even if A::A(A&&) exists
}我可以想象,在函数内部,<em
即将推出的C++标准C++0x的一个很酷的新特性是“右值引用”。右值引用类似于左值(正常)引用,不同之处在于它可以绑定到临时值(通常,临时值只能绑定到const引用):void FunctionWithRValueRef); // error, 5 is a temporary
FunctionWithRValueRe