3 ms·
No, it's not harder than in C++. Compare: https://gist.github.com/stjepang/07fbf88afa824e11796e51ea2f68bd5a https://gist.github.com/stjepang/07fbf88afa824e11796
by v_lisivka 8y ago
No, it's not harder than in C++. Compare: https://gist.github.com/stjepang/07fbf88afa824e11796e51ea2f68bd5a https://gist.github.com/stjepang/07fbf88afa824e11796e51ea2f6... , https://gist.github.com/stjepang/fc20ea97030a2153148117dddeb239b3 https://gist.github.com/stjepang/fc20ea97030a2153148117dddeb... .
In Rust, it even works faster (with array bounds check!).
- TheDong 8y agoPlease just use an `Option<usize>`, not that wonky NULL thing. If you're worried about the slightly more memory that uses, you can use `Option<NonZeroUsize>` and subtract 1 for all indexing operations.