次の方法で共有


queue::push

キューの戻るに要素を追加します。

void push( 
   const Type& val 
);

パラメーター

  • val
    キューの戻るに追加する要素。

解説

キューの戻るは最後にする位置によって追加された要素で、コンテナーの端に最後の要素です。

使用例

// 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;
}
  

必要条件

ヘッダー: <キュー>

名前空間: std

参照

関連項目

queue クラス

queue 関数

標準テンプレート ライブラリ