STL deque accessing by index is O(1)?
- by jasonline
I've read that accessing elements by position index can be done in constant time in a STL deque. As far as I know, elements in a deque may be stored in several non-contiguous locations, eliminating safe access through pointer arithmetic. For example:
abc-defghi-jkl-mnop
The elements of the deque above consists of a single character. The set of…