queue ds c++ code example

Example: queue c++

//Queue is a data structure designed to operate in FIFO(First in First out) context. 
//In queue elements are inserted from rear end and get removed from front end.
 The functions supported by queue:
 ---------------------------------
 empty()   | Tests whether queue is empty or not.
 size()    | Returns the total number of elements present in the queue.
 push()    | Inserts new element at the end of queue.
 emplace() | Constructs and inserts new element at the end of queue.
 pop()     | Removes front element of the queue.
 swap()    | Exchanges the contents of queue with contents of another queue.
 front()   | Returns a reference to the first element of the queue.
 back()    | Returns a reference to the last element of queue.

Tags:

Cpp Example