std::dequeis the closest standard container to what you are describing. However, this is not entirely true (for example, to a large extent it should be an array of arrays, not a list of arrays, since the latter does not allow access to the element with constant time).
Depending on your practical requirements, this may be close enough.
source
share