Compartilhar via


array::crend

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

const_reverse_iterator crend( ) const;

Return Value

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).

Remarks

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

See Also

Reference

<array>

array Class (STL)

Standard Template Library