Compartilhar via


array::crbegin

Returns a const iterator to the first element in a reversed array.

const_reverse_iterator crbegin( ) const;

Return Value

A const reverse random-access iterator addressing the first element in a reversed array or addressing what had been the last element in the unreversed array.

Remarks

With the return value of crbegin, the array object cannot be modified.

Example

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

int main( )
{
   using namespace std;   
   array<int, 2> v1 = {1, 2};
   array<int, 2>::iterator v1_Iter;
   array<int, 2>::const_reverse_iterator v1_rIter;
   
   v1_Iter = v1.begin( );
   cout << "The first element of array is "
        << *v1_Iter << "." << endl;

   v1_rIter = v1.crbegin( );
   cout << "The first element of the reversed array is "
        << *v1_rIter << "." << endl;
}
The first element of array is 1.
The first element of the reversed array is 2.

Requirements

Header: <array>

Namespace: std

See Also

Reference

<array>

array Class (TR1)

Standard Template Library

Other Resources

<array> Members