list::pop_front
刪除清單開頭的項目。
void pop_front( );
備註
第一個項目不能是空的。 pop_front不擲回例外狀況。
範例
// list_pop_front.cpp
// compile with: /EHsc
#include <list>
#include <iostream>
int main( )
{
using namespace std;
list <int> c1;
c1.push_back( 1 );
c1.push_back( 2 );
cout << "The first element is: " << c1.front( ) << endl;
cout << "The second element is: " << c1.back( ) << endl;
c1.pop_front( );
cout << "After deleting the element at the beginning of the list, "
"the first element is: " << c1.front( ) << endl;
}
需求
標題: <list>
命名空間: std