Udostępnij za pośrednictwem


queue::push

Dodaje element do tyłu kolejki.

void push(
   const Type& val
);

Parametry

  • val
    Element dodany do tyłu kolejki.

Uwagi

Z tyłu kolejki jest Stanowisko zajęte przez element ostatnio dodane i ostatni element na końcu pojemnika.

Przykład

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

int main( )
{
   using namespace std;
   queue <int> q1;

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

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

   i = q1.front( );
   cout << "The element at the front of the queue is "
        << i << "." << endl;
}
  
  

Wymagania

Nagłówek: <queue>

Obszar nazw: std

Zobacz też

Informacje

queue Class

queue Functions

Standardowa biblioteka szablonu