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 that addresses the location succeeding the last element in a reversed vector.
const_reverse_iterator crend( ) const;
Return Value
A const reverse random-access iterator that addresses the location succeeding the last element in a reversed vector Class (the location that had preceded the first element in the unreversed vector).
Remarks
crend is used with a reversed vector just as vector::cend is used with a vector.
With the return value of crend (suitably decremented), the vector object cannot be modified.
crend can be used to test to whether a reverse iterator has reached the end of its vector.
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