4 ms·
C++ developers constantly wrestle with `vector` iterator invalidations. Good on Zig for making this a first-class concern.
by stub_out 1mo ago
C++ developers constantly wrestle with `vector` iterator invalidations. Good on Zig for making this a first-class concern.
- brcmthrowaway 1mo agoHow does Rust avoid this?
- trucks-refinish 1mo agoIn rust you cannot mutate anything that is being read basically. The borrow checker enforces this. So an iterator takes an immutable reference to the vector and mutation requires a mut ref, and you can't have both at the same time.