operator=(type &&)

When does it get used? Some googling gives me the move constructor, not this "move operator".
Whenever you have an rvalue or an xvalue as the right-hand argument of operator=, same as the move constructor pretty much:

1
2
3
std::string s2 = "world";
std::string s1 = s2.substr(1); // move constructor
s1 = s2.substr(3); // move assignment 
Ah, that makes sense. Is it just a lucky quirk of the new syntax or is it an intended effect? Basically, does it have any special treatment like operator=(type &) does or is it just another function that happens to accept an rvalue reference?
It gets the same (well, similar) special treatment:
http://en.cppreference.com/w/cpp/language/move_operator
Topic archived. No new replies allowed.