3 ms·
I was recently faced with this (luckily I realized it before coming across any strange bugs), and realized std::deque works great for this if you don’t need ran
by sakras 3y ago
I was recently faced with this (luckily I realized it before coming across any strange bugs), and realized std::deque works great for this if you don’t need random access (which was fine for my use-case because I just grabbed references immediately after insertion).
- quietbritishjim 3y agostd::deque has O(1) access by index so it's fine for random access (although it has some extra indirection so it's still slower than vector)