3 ms·
Or move semantics including rvalue references. In retrospect, objects should have been moved by default (and destructors for moved-from objects not called), lik
by quietbritishjim 6y ago
Or move semantics including rvalue references. In retrospect, objects should have been moved by default (and destructors for moved-from objects not called), like Rust. Then copying can just be an explicit normal method (that returns its result by moving it!).
- Veedrac 6y ago> and destructors for moved-from objects not called This doesn't work entirely cleanly in cases the compiler can't track liveness, which is more of an issue for C++ than Rust, since you want to be able to move out of pointers. A simple solution is to replace move operators with an `invalidate` function the compiler calls after doing a shallow move, that sets the old value to a moved-from state. Copy constructors (as opposed to copy assignment operators) are already a fine way to copy a value, there's no real need to change that.
- deleted 6y ago[deleted]