This documentation is archived and is not being maintained.

vector::cend

Returns the past-the-end iterator.

const_iterator cend( ) const;

The const past-the-end iterator for the vector Class. If the vector is empty, vector::cend() == vector::cbegin().

With the return value of cend (suitably decremented), the vector object cannot be modified.

// vector_cend.cpp
// compile with: /EHsc
#include <vector>
#include <iostream>
int main( )
{
   using namespace std;
   vector <int> v1;
   vector <int>::const_iterator v1_Iter;
   
   v1.push_back( 1 );
   v1.push_back( 2 );

   for ( v1_Iter = v1.cbegin( ) ; v1_Iter != v1.cend( ) ; v1_Iter++ )
      cout << *v1_Iter << endl;
}
1
2

Header: <vector>

Namespace: std

Show: