2 ms·
It’s a natural consequence of value semantics and not supporting references / pointers with range syntax :). (You can still write the same bug in Rust or C++ a
by tylerhou 3y ago
It’s a natural consequence of value semantics and not supporting references / pointers with range syntax :).
(You can still write the same bug in Rust or C++ accidentally.)
- sapiogram 3y ago> You can still write the same bug in Rust I honestly don't think you can. If you try to iterate over values instead of references, you'll take ownership of the vector and not be able to use it again.
- tylerhou 3y agoIf the value is Copy, you will make a copy and won’t take ownership, right? (Iterate over a vector of ints). Granted Rust structs are not Copy by default. Same with any C++ class for which there is no copy constructor.