Freigeben über


queue::size

Gibt die Anzahl der Elemente in der Warteschlange zurück.

size_type size( ) const;

Rückgabewert

Die aktuelle Länge der Warteschlange.

Beispiel

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

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

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

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

Anforderungen

Header: <Warteschlange>

Namespace: std

Siehe auch

Referenz

queue-Klasse

queue-Funktionen

Standardvorlagenbibliothek