4 ms·
It is trivial to implement doubly linked list. Just use unsafe. What is difficult is to implement it in the safe Rust. But then try to proof that, say, C++, co
by fpoling 8y ago
It is trivial to implement doubly linked list. Just use unsafe.
What is difficult is to implement it in the safe Rust. But then try to proof that, say, C++, code doing the same is safe. It is very hard.
Besides, if one really wants cyclic structures in safe Rust, one can always do ancient Fortran trick and just represent pointers with array indexes. It may even be faster due to more cache-friendly memory layout.