priority_queue::empty
Teste si un priority_queue est vide.
bool empty( ) const;
Valeur de retour
true si le priority_queue est vide ; false si le priority_queue n'est pas vide.
Exemple
// 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;
}
Configuration requise
en-tête : <queue>
l'espace de noms : DST