「cpp/string/basic string/rend」の版間の差分
提供: cppreference.com
編集の要約なし |
P0980R1 |
||
| 4行目: | 4行目: | ||
{{dcl rev multi | num=1 | until1=c++11 | dcl1= | {{dcl rev multi | num=1 | until1=c++11 | dcl1= | ||
reverse_iterator rend(); | reverse_iterator rend(); | ||
| dcl2= | | dcl2= | ||
reverse_iterator rend() noexcept; | reverse_iterator rend() noexcept; | ||
}} | }} | ||
{{dcl rev multi | num=2 | until1=c++11 | dcl1= | {{dcl rev multi | num=2 | until1=c++11 | dcl1= | ||
const_reverse_iterator rend() const; | const_reverse_iterator rend() const; | ||
| dcl2= | | dcl2= | ||
const_reverse_iterator rend() const noexcept; | const_reverse_iterator rend() const noexcept; | ||
}} | }} | ||
{{dcl | num=3 | | {{dcl | num=3 | ||
| =c++11 | | |||
const_reverse_iterator crend() const noexcept; | const_reverse_iterator crend() const noexcept; | ||
}} | }} | ||
{{dcl end}} | {{dcl end}} | ||
2020年2月18日 (火) 11:55時点における最新版
<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 rend(); |
(C++11未満) | |
reverse_iterator rend() noexcept; |
(C++11以上) (C++20未満) |
|
constexpr reverse_iterator rend() noexcept; |
(C++20以上) | |
| (2) | ||
const_reverse_iterator rend() const; |
(C++11未満) | |
const_reverse_iterator rend() const noexcept; |
(C++11以上) (C++20未満) |
|
constexpr const_reverse_iterator rend() const noexcept; |
(C++20以上) | |
| (3) | ||
const_reverse_iterator crend() const noexcept; |
(C++11以上) (C++20未満) |
|
constexpr const_reverse_iterator crend() const noexcept; |
(C++20以上) | |
逆になった文字列の最後の文字の次の文字を指す逆イテレータを返します。 これは逆になっていない文字列の最初の文字の前の文字に対応します。 この文字はプレースホルダの役割を持ちます。 この文字にアクセスを試みると未定義動作になります。
引数
(なし)
戻り値
最後の文字の次の文字を指す逆イテレータ。
計算量
一定。
例
Run this code
#include <algorithm>
#include <iostream>
#include <iterator>
#include <string>
int main()
{
std::string s("A man, a plan, a canal: Panama");
{
std::string c;
std::copy(s.rbegin(), s.rend(), std::back_inserter(c));
std::cout << c <<'\n'; // "amanaP :lanac a ,nalp a ,nam A"
}
{
std::string c;
std::copy(s.crbegin(), s.crend(), std::back_inserter(c));
std::cout << c <<'\n'; // "amanaP :lanac a ,nalp a ,nam A"
}
}
出力:
amanaP :lanac a ,nalp a ,nam A
amanaP :lanac a ,nalp a ,nam A
関連項目
(C++11) |
先頭を指す逆イテレータを返します (パブリックメンバ関数) |