jackhab jackhab - 1 year ago 129
C++ Question

std::queue iteration

I need to iterate over

www.cplusplus.com says:

By default, if no container class is specified for a particular queue class, the standard container class template deque is used.

So can I somehow get to the queue's underlying deque and iterate over it?

Answer Source

If you need to iterate over a queue then you need something more than a queue. The point of the standard container adapters is to provide a minimal interface. If you need to do iteration as well, why not just use a deque (or list) instead?