Re:A Fast, Growable Array with Stable Pointers in C
by sestep on Wednesday August 06, 2025 @03:26PM
(#44816515)
Does std::deque support random access?
[ Parent
| on HN ]
Re:A Fast, Growable Array with Stable Pointers in C
by mwkaufma on Wednesday August 06, 2025 @03:28PM
(#44816539)
Yes, you can see operator[] in the linked reference docs.
Re:A Fast, Growable Array with Stable Pointers in C
by ksherlock on Wednesday August 06, 2025 @05:34PM
(#44818114)
The cppreference documentation specifies "Random access - constant O(1)" (same as std::vector). There's a slight overhead from going through 2 pointers instead of 1 and keeping track of how many items are in the first bucket (so you know which bucket to check), but that's a constant and the big O don't care about constants.