I'm looking for standard container (if any exists) that will have constant time for:
- access any element by position
- pop element from the front
- push element at back
I can program it by myself, but why bother if it could already exist in std
?
I'm looking for standard container (if any exists) that will have constant time for:
I can program it by myself, but why bother if it could already exist in std
?
std::deque is your friend. It's a double-ended queue with random access to elements.
You can use a std::deque. It satisfy's all your requirements.
It provides random access using random iterators, as well as operator []
It provides pop_front()
It provides push_back()