vector::crend

Returns a const__reverse_iterator that points to one before the first element in the vector.

const_reverse_iterator crend( ) const;

Return Value

A const reverse random-access iterator that points to one before the first element in the vector.

Remarks

Reverse iterators go backwards over the sequence, so the last element in a reverse iteration is one before the first element in the vector.

crend is used to test to whether a reverse iterator has reached the end of its sequence.

The value returned by crend should not be dereferenced.

Example

// vector_crend.cpp
// compile with: /EHsc
#include <vector>
#include <iostream>

int main( )
{
   using namespace std;   
   vector <int> v1;
   vector <int>::const_reverse_iterator v1_rIter;
   
   v1.push_back( 1 );
   v1.push_back( 2 );

   for ( v1_rIter = v1.rbegin( ) ; v1_rIter != v1.rend( ) ; ++v1_rIter )
      cout << *v1_rIter << endl;
}
2
1

Requirements

Header: <vector>

Namespace: std

See Also

Reference

vector Class

Standard Template Library