Compartilhar via


priority_queue::size

Retorna o número de elementos em priority_queue.

size_type size( ) const;

Valor de retorno

O comprimento atual de priority_queue.

Exemplo

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

int main( )
{
   using namespace std;
   priority_queue <int> q1, q2;
   priority_queue <int>::size_type i;

   q1.push( 1 );
   i = q1.size( );
   cout << "The priority_queue length is " << i << "." << endl;

   q1.push( 2 );
   i = q1.size( );
   cout << "The priority_queue length is now " << i << "." << endl;
}
  
  

Requisitos

Cabeçalho: <queue>

namespace: STD

Consulte também

Referência

priority_queue Class

priority_queue Functions

Standard Template Library