Quick Q: If I have a T&&, why would I write std::move? -- StackOverflow

Here's a common question about the relationship between && and std::move. It includes links to related variations of the question -- aka duplicates, though they're not always exact duplicates and it's helpful to see answers on different aspects of the same core question.

In C++11, why use std::move when you have &&?

I recently attended a C++11 seminar and the following tidbit of advice was given.

when you have && and you are unsure, you will almost always use std::move

Could any one explain to me why [when you already have a T&& -- Ed.] you should use std::move as opposed to some alternatives and some cases when you should not use std::move?

Add a Comment

Comments are closed.

Comments (0)

There are currently no comments on this entry.