Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Returns a const iterator addressing the first element in a list.
const_iterator cbegin( ) const;
Return Value
A const bidirectional iterator addressing the first element in the list Class or to the ___location succeeding an empty list.
Remarks
With the return value of cbegin, the elements in the list object cannot be modified.
Example
// 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
Requirements
Header: <list>
Namespace: std