Does C ++ have a standard queue?

I know that in C ++ there is a standard library vector. Is there a queue? An online search suggests that it may be, but not so much, if any.

Edit: Good. Thanks to the toners.

+6
c ++ queue
source share
7 answers

std :: queue (container adapter)

+13
source share

Yes, you can easily choose a base container if you are interested:

#include <queue> int main() { std::queue<int> myqueue; myqueue.push(3); int x = myqueue.front(); myqueue.pop(); // pop is void! } 
+14
source share

Yes, there is std::queue . Implemented as โ€œadaptersโ€ on top of an existing container (since this is basically just a specialization).

+5
source share
+4
source share
+3
source share

Another good link for standard C ++ libraries is http://www.cplusplus.com .

In particular, their reference section: http://www.cplusplus.com/reference/ .

Here is their page for std :: queue: http://www.cplusplus.com/reference/stl/queue/ .

+3
source share

Alternatively, you can find std :: deque (double queue), depending on what you need for the queue

+1
source share

All Articles