(no title)
barakm | 3 years ago
That Rust can check these somewhat more explicitly (rather than via good coding style) and that C++ also allows you to do arbitrary permutations (a la non-const references) is what you’re talking about. But ownership is very very real in C++! Just look at the craziness that is move semantics!
arcticbull|3 years ago
These have very different semantics. Lexically you can only have either 1 mutable reference or N immutable references at a time to a given object. This is the foundation for a lot of the safety and aliasing [2] guarantees. Just because they both use an '&' doesn't make them equivalent! :)
Don't get my started on `std::move` which doesn't really move, and continues to allow you to use the source object - in whatever condition it may be in. These are also not the same. C++ move semantics are sort of the 'ruined fresco' [1] of Rust move semantics.
[1] https://www.npr.org/sections/thetwo-way/2012/09/20/161466361...
[2] https://doc.rust-lang.org/nomicon/aliasing.html
unknown|3 years ago
[deleted]
synergy20|3 years ago