GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
std::array::rend,std::array::crend(3) C++ Standard Libary std::array::rend,std::array::crend(3)

std::array::rend,std::array::crend - std::array::rend,std::array::crend


reverse_iterator rend() noexcept; (until C++17)
constexpr reverse_iterator rend() noexcept; (since C++17)
const_reverse_iterator rend() const noexcept; (until C++17)
constexpr const_reverse_iterator rend() const noexcept; (since C++17)
const_reverse_iterator crend() const noexcept; (until C++17)
constexpr const_reverse_iterator crend() const noexcept; (since C++17)


Returns a reverse iterator to the element following the last element of the reversed
array. It corresponds to the element preceding the first element of the non-reversed
array. This element acts as a placeholder, attempting to access it results in
undefined behavior.


range-rbegin-rend.svg


(none)


Reverse iterator to the element following the last element.


Constant.

// Run this code


#include <algorithm>
#include <array>
#include <iostream>


int main()
{
std::array<int, 11> a {1, 11, 11, 35, 0, 12, 79, 76, 76, 69, 40};


// print elements of array in reverse order using const_reverse_iterator`s
std::for_each(a.crbegin(), a.crend(), [](int e){ std::cout << e << ' '; });
// ^^ ^^
std::cout << '\n';


// modify each element of array using non-const reverse_iterator`s
std::for_each(a.rbegin(), a.rend(), [](int& e){ e += 32; });
// ^ ^ ^


// print elements as chars in reverse order using const_reverse_iterator`s
std::for_each(a.crbegin(), a.crend(), [](char e){ std::cout << e; });
// ^^ ^^ ^^^^
std::cout << '\n';
}


40 69 76 76 79 12 0 35 11 11 1
Hello, C++!


rbegin returns a reverse iterator to the beginning
crbegin (public member function)
(C++11)
rend returns a reverse end iterator for a container or array
crend (function template)
(C++14)

2022.07.31 http://cppreference.com

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.