rvalue references in Visual Studio 2010
What are the differences between rvalue references as implemented in Visual Studio 2010 and as specified in the C++11? A开发者_如何学Gore there any particular pitfalls to watch out for when using revalue references in Visual Studio 2010 that could make source invalid or working differently if compiled by C++11 conforming compiler?
According to this table, VS2010 supports rvalue references version 2.0 (the current version is 2.1 IIRC).
The important difference between 2.0 and 2.1 is that the latter allows implicit conversions:
std::string&& x = "hello"; // legal in 2.1, illegal in 2.0
Also note that VS2010 does not yet support overloading on the rvalueness of *this
.
void Foo::foo() && { ... } // not yet supported in VS2010
Check the instalment number 9 of Stephan T. Lavavej's video lectures at Channel 9 from 42:30 min onwards. He explains timeline and evolution of the rvalue references and move semantic in Visual Studio.
Here it is: C9 Lectures: Stephan T. Lavavej - Standard Template Library (STL), 9 of n
精彩评论