std::basic_string<CharT,Traits,Allocator>::rbegin, std::basic_string<CharT,Traits,Allocator>::crbegin
: cppreference.com
<tbody>
</tbody>
<tbody class="t-dcl-rev t-dcl-rev-num ">
</tbody><tbody>
</tbody>
<tbody class="t-dcl-rev t-dcl-rev-num ">
</tbody><tbody>
</tbody>
<tbody class="t-dcl-rev t-dcl-rev-num ">
</tbody><tbody>
</tbody>
| (1) | ||
reverse_iterator rbegin(); |
(C++11) | |
reverse_iterator rbegin() noexcept; |
(C++11) (C++20) |
|
constexpr reverse_iterator rbegin() noexcept; |
(C++20) | |
| (2) | ||
const_reverse_iterator rbegin() const; |
(C++11) | |
const_reverse_iterator rbegin() const noexcept; |
(C++11) (C++20) |
|
constexpr const_reverse_iterator rbegin() const noexcept; |
(C++20) | |
| (3) | ||
const_reverse_iterator crbegin() const noexcept; |
(C++11) (C++20) |
|
constexpr const_reverse_iterator crbegin() const noexcept; |
(C++20) | |
()
Run this code
#include <iostream>
#include <algorithm>
#include <iterator>
#include <string>
int main()
{
std::string s("Exemplar!");
*s.rbegin() = 'y';
std::cout << s << '\n'; // "Exemplary"
std::string c;
std::copy(s.crbegin(), s.crend(), std::back_inserter(c));
std::cout << c << '\n'; // "yralpmexE"
}
:
Exemplary
yralpmexE
(C++11) |
() |