Reputation: 1
Since the queue can be implemented both ways, I wonder which is being used by the Queue STL.
Upvotes: 0
Views: 454
Reputation: 16670
A queue
is a container adaptor; it provides queue-like behavior using a different container for the underlying storage. Either deque
or list
are suitable for the underlying storage of a queue. See http://eel.is/c++draft/queue for all the gory details.
Neither is a circular array.
Upvotes: 2
Reputation: 322
Checking some documentation, the complexity of insertion for this type of container is constant, if you use a vector you can't have a constant complexity because you could need resize vector, then it use a linked list.
Upvotes: 0