共用方式為


queue::pop

從佇列的前端移除項目。

void pop( );

備註

佇列必須為非空白將成員函式。 佇列頂端的是最近加入的項目所佔用之定位和是最後一個項目至容器結尾。

範例

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

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

   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;

   q1.pop( );

   i = q1.size( );
   cout << "After a pop the queue length is " 
        << i << "." << endl;

   i = q1. front ( );
   cout << "After a pop, the element at the front of the queue is "
        << i << "." << endl;
}
  
  
  
  

需求

標題: <queue>

命名空間: std

請參閱

參考

queue Class

queue Functions

標準樣板程式庫