News for hackers. Stuff that matters.
Re:C++11 FAQ by cmrdporcupine on Thursday January 26, 2017 @10:55AM (#13492357)
My perhaps naive uneducated opinion: they should have added syntactic sugar for it instead of making it look like a function. A new operator perhaps.
Re:C++11 FAQ by kevinnk on Thursday January 26, 2017 @12:55PM (#13493526)
How does adding an operator help? There are two main advantage of having move semantics in the language and at least one of them relies on the fact that moves are implicit; you can write code that will move objects if supported and copy/destroy if not (for example, when returning an object or using an intermediate value in an expression). Adding an operator erases that advantage.

The other advantage is that you can force only move semantics which allows enforcing things like ownership. Adding an operator doesn't destroy this advantage, but it is a bit silly since you're just adding line noise for something that really should be implicit anyway.

Unless you just literally don't like the spelling of "std::move" which seems pretty lame since it should be relatively rare anyway.

Re:C++11 FAQ by dragontamer on Thursday January 26, 2017 @10:59AM (#13492395)
> A new operator perhaps.

That'd invalidate a lot of programs. Just like how the new _ operator in Java is killing a lot of code right now.

Every symbol that can be used... has been used. "Move" is the meaning of the operator in any case. Its no less readable than say... Python's __lshift__ or __add__.

Re:C++11 FAQ by sqeaky on Thursday January 26, 2017 @11:33AM (#13492744)
What if a hypothetical new operator used only characters already not allowed in identifiers and composed of characters not allowed in contiguous operator sequences.

Consider: :=, <-=, <|, $,

Re:C++11 FAQ by cbsmith on Thursday January 26, 2017 @01:18PM (#13493768)
AFAIK, _ isn't an operator in Java (http://docs.oracle.com/javase/specs/jls/se8/html/jls-3.html#...). The language does allow _ to be used as a separator in numeric literals.

Is there a new operator in some upcoming version of the language specification?

Re:C++11 FAQ by yrro on Thursday January 26, 2017 @02:22PM (#13494386)
_ is a keyword in Java 9.
Re:C++11 FAQ by cbsmith on Friday January 27, 2017 @02:35AM (#13498327)
It isn't an operator though, right?
Re:C++11 FAQ by yrro on Friday January 27, 2017 @11:10AM (#13500571)
That's correct, I only intended to clarify your point.