queue::empty()

empty() function is used to check if the queue container is empty or not.

Syntax

queueName.empty()

Parameters

  • This function does not accept any parameter.

Return Value

  • It returns True if the list is empty, else it returns False.

Examples

Input: myqueue = 1, 2, 3
       myqueue.empty();
Output: False

Input: myqueue
       myqueue.empty();
Output: True

Errors and Exceptions

  1. Shows an error if a parameter is passed.
  2. Shows no exception throw guarantee.

queue::empty() and queue::size() in C++ STL

Queue is a type of container adaptor that operate in a first in first out (FIFO) type of arrangement. Elements are inserted at the back (end) and are deleted from the front.

Similar Reads

queue::empty()

empty() function is used to check if the queue container is empty or not....

Examples of queue::empty()

Example 1...

queue::size()

...

Examples of queue::size()

...