- What is it?
- What does it do?
- When should it be used?
Good links are appreciated.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Wikipedia Page on C++11 R-value references and move constructors
(And in addition to copy assignment operators, they have move assignment operators.)
Type &&).std::move()is a cast that produces an rvalue-reference to an object, to enable moving from it.It’s a new C++ way to avoid copies. For example, using a move constructor, a
std::vectorcould just copy its internal pointer to data to the new object, leaving the moved object in an moved from state, therefore not copying all the data. This would be C++-valid.Try googling for move semantics, rvalue, perfect forwarding.