Export (0) Print
Expand All

deque::crend

Returns a const iterator that addresses the location succeeding the last element in a reversed deque.

const_reverse_iterator crend( ) const;

A const reverse random-access iterator that addresses the location succeeding the last element in a reversed deque Class (the location that had preceded the first element in the unreversed deque).

crend is used with a reversed deque just as array::cend is used with a deque.

With the return value of crend (suitably decremented), the deque object cannot be modified.

crend can be used to test to whether a reverse iterator has reached the end of its deque.

The value returned by crend should not be dereferenced.

// deque_crend.cpp
// compile with: /EHsc
#include <deque>
#include <iostream>

int main( )
{
   using namespace std;   
   deque <int> v1;
   deque <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

Header: <deque>

Namespace: std

Show:
© 2014 Microsoft