The Queue Adaptors
The queue
and priority_queue
adaptors are defined in the queue
header. Table 9.19 lists the operations supported by these types.
The library queue
uses a first-in, first-out (FIFO) storage and retrieval policy. Objects entering the queue are placed in the back and objects leaving the queue are removed from the front. A restaurant that seats people in the order in which they arrive is an example of a FIFO queue.
A priority_queue
lets us establish a priority among the elements held in the queue. Newly added elements are placed ahead of all the elements with ...
Get C++ Primer, Fifth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.