News for hackers. Stuff that matters.
Re:C++'s Rule of Zero by quicknir on Sunday June 28, 2015 @05:07PM (#9795111)
Yes, of course you can do that, but you lose certain things. In C++ you can write code (e.g constructors) that will do the right thing with their arguments, move or copy, based on whether the input is an rvalue or not. Is there a way to get this behavior in rust?
Re:C++'s Rule of Zero by FreeFull on Sunday June 28, 2015 @08:15PM (#9795724)
In Rust, move semantics are assumed by default, and it's up to the caller to make a copy using .clone() if they want to keep ownership of the value (unless they know Copy is implemented and it's unnecessary, for example for integer types).