Today on SO, a frequently asked question and a nicely summed up answer:
std::move on a variable which already is T&&
On the page http://msdn.microsoft.com/en-us/library/dd293665.aspx Microsoft has an example on how to write a move constructor. It is essentially of the form:
MyClass::MyClass(MyClass&& lhs) { *this = std::move(lhs); }I have tried and
std::move
really is required here, but why? I thought the only thing move did was to convert toT&&
. But lhs is already of typeMyClass&&
, is it not?
Add a Comment
Comments are closed.