std::span<T,Extent>::rbegin, std::span<T,Extent>::crbegin
From cppreference.com
C++
Feature test macros (C++20)
Concepts library (C++20)
Metaprogramming library (C++11)
Ranges library (C++20)
Filesystem library (C++17)
Concurrency support library (C++11)
Execution control library (C++26)
Containers library
(C++17)
(C++11)
(C++26)
(C++26)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++23)
(C++23)
(C++23)
(C++23)
(C++20)
(C++23)
Tables
std::span
(C++26)
(C++23)
(C++23)
span::rbeginspan::crbegin
(C++23)
(C++23)
constexpr reverse_iterator rbegin() const noexcept;
(1)
(since C++20)
constexpr const_reverse_iterator crbegin() const noexcept;
(2)
(since C++23)
Returns a reverse iterator to the first element of the reversed *this. It corresponds to the last element of the non-reversed *this.
If *this is empty, the returned iterator is equal to rend().
Contents
[edit] Return value
Reverse iterator to the first element.
[edit] Complexity
Constant.
[edit] Notes
The underlying iterator of the returned reverse iterator is the end iterator. Hence the returned iterator is invalidated if and when the end iterator is invalidated.
[edit] Example
Run this code
#include <algorithm> #include <iostream> #include <iterator> #include <span> int main() { constexpr std::span <const char> code{"@droNE_T0P_w$s@s#_SECRET_a,p^42!"}; auto hack = [](const unsigned O) { return O - 0141 < 120; }; std::copy_if (code.rbegin(), code.rend(), std::ostream_iterator <const char>(std::cout ), hack); std::cout << '\n'; }
Output:
password
[edit] See also
(C++14)
(function template) [edit]