Udostępnij za pośrednictwem


priority_queue::pop

Usuwa element największą priority_queue z górnej pozycji.

void pop( );

Uwagi

Priority_queue nie może być puste, aby zastosować funkcję członka.Górnej części priority_queue zawsze jest zajęte przez element największy w kontenerze.

Przykład

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

int main( )
{
   using namespace std;
   priority_queue <int> q1, s2;

   q1.push( 10 );
   q1.push( 20 );
   q1.push( 30 );

   priority_queue <int>::size_type i, iii;
   i = q1.size( );
   cout << "The priority_queue length is " << i << "." << endl;

   const int& ii = q1.top( );
   cout << "The element at the top of the priority_queue is "
        << ii << "." << endl;

   q1.pop( );

   iii = q1.size( );
   cout << "After a pop, the priority_queue length is " 
        << iii << "." << endl;

   const int& iv = q1.top( );
   cout << "After a pop, the element at the top of the "
        << "priority_queue is " << iv << "." << endl;
}
  

Wymagania

Nagłówek:<kolejki>

Przestrzeń nazw: std

Zobacz też

Informacje

priority_queue — Klasa

priority_queue — Funkcje

Standardowa biblioteka szablonów