Windows Dev Center

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::crbegin

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

const_reverse_iterator crbegin( ) const;

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.

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

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

Header: <array>

Namespace: std

Show:
© 2015 Microsoft