3 ms·
Using a Vec for doubly linked lists sounds like overkill. There's got to be more efficient and more elegant way.
by amelius 2y ago
Using a Vec for doubly linked lists sounds like overkill. There's got to be more efficient and more elegant way.
- unrealhoang 2y agoYes, there is, just use plain old pointers. Who cares about UB anyway.
- thayne 2y agoUsing a Vec actually has some benefits beyond the safety guarantees from rust. There are fewer allocations, and you probably are more likely to get nearby nodes on the same cache line.