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) |
終端を指す逆イテレータを返します (パブリックメンバ関数) |