list::cbegin

傳回處理常數的列舉值清單中的第一個項目。

const_iterator cbegin( ) const;

傳回值

解決const雙向Iterator的第一個項目 list Class 是成功或空的 list的位置。

備註

cbegin的傳回值,不能修改在 list 物件的項目。

範例

// list_cbegin.cpp
// compile with: /EHsc
#include <list>
#include <iostream>

int main( ) 
{
   using namespace std;
   list <int> c1;
   list <int>::const_iterator c1_cIter;
   
   c1.push_back( 1 );
   c1.push_back( 2 );

   c1_cIter = c1.cbegin( );
   cout << "The first element of c1 is " << *c1_cIter << endl;
}

Output

The first element of c1 is 1

需求

標題: <list>

命名空間: std

請參閱

參考

list Class

標準樣板程式庫