返回解决常数的迭代器列表中的第一个元素。
const_iterator cbegin( ) const;
返回值
解决const双向的迭代器第一个元素在 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