C++ STL: Queue

C++ STL: Queue

This is somewhat analogous to stacks, with a slight difference being that it does not follow LIFO, it follows FIFO (First in first out).
Imagine Queue analogous to queues in front of the theatres' ticket counters.

The elements are inserted into one end and extracted from the other.

Here are some useful member functions for queues:

Member functions: STL queue

  • empty: Test whether the queue is empty or not
  • size: returns the size of the queue
  • front: Access the element at the front of the queue.
  • back: Access the element at the last of the queue.
  • push: Inserts elements at the end of the queue.
  • emplace: Construct and insert an element at the end of the queue.
  • pop: Remove an element from the front.
  • swap: swap the contents of two queue.

Here is the link to the official documentation of queue: 

No comments:

Post a Comment

Installing albert on ubuntu 19.04

Installing Albert on Ubuntu 19.04... Albert is not still released for ubuntu 19.04. But still, you can install it using the following ...