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 函数

标准模板库