Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

array::crend

 

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

const_reverse_iterator crend( ) const noexcept;

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

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

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

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

The value returned by crend should not be dereferenced.

Example

// array_crend.cpp
// compile with: /EHsc
#include <array>
#include <iostream>

int main( )
{
   using namespace std;   
   array<int, 2> v1 = {1, 2};
   array<int, 2>::const_reverse_iterator v1_rIter;

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

Requirements

Header: <array>

Namespace: std

Show:
© 2016 Microsoft