Compartilhar via


priority_queue::empty

Teste se um priority_queue está vazia.

bool empty( ) const;

Valor de retorno

true se o priority_queue está vazia; false se o priority_queue é não vazio.

Exemplo

// pqueue_empty.cpp
// compile with: /EHsc
#include <queue>
#include <iostream>

int main( )
{
   using namespace std;

   // Declares priority_queues with default deque base container
   priority_queue <int> q1, s2;

   q1.push( 1 );

   if ( q1.empty( ) )
      cout << "The priority_queue q1 is empty." << endl;
   else
      cout << "The priority_queue q1 is not empty." << endl;

   if ( s2.empty( ) )
      cout << "The priority_queue s2 is empty." << endl;
   else
      cout << "The priority_queue s2 is not empty." << endl;
}
  
  

Requisitos

Cabeçalho: <queue>

namespace: STD

Consulte também

Referência

priority_queue Class

priority_queue Functions

Standard Template Library