std::multiset<Key,Compare,Allocator>:: rend, std::multiset<Key,Compare,Allocator>:: crend
From ja.cppreference.net
|
reverse_iterator rend
(
)
;
|
(1) |
(C++11以降 noexcept)
(C++26以降 constexpr) |
|
const_reverse_iterator rend
(
)
const
;
|
(2) |
(C++11以降 noexcept)
(C++26以降 constexpr) |
|
const_reverse_iterator crend
(
)
const
noexcept
;
|
(3) |
(C++11以降)
(C++26以降 constexpr) |
逆方向の * this の最後の要素の次を指す逆方向イテレータを返します。これは、逆方向ではない * this の最初の要素の前の要素に対応します。
この返されたイテレータはセンチネルとしてのみ機能します。これが デリファレンス可能 であることは保証されません。
目次 |
戻り値
最後の要素の次の要素への逆方向イテレータ。
計算量
定数。
注記
iteratorとconst_iteratorの両方が定数イテレータであるため(実際には同じ型である可能性もあります)、これらのメンバ関数によって返されるイテレータを通じてコンテナの要素を変更することはできません。
libc++はC++98モードに
crend()
をバックポートします。
例
このコードを実行
#include <iostream> #include <set> int main() { std::multiset<unsigned> rep{1, 2, 3, 4, 1, 2, 3, 4}; for (auto it = rep.crbegin(); it != rep.crend(); ++it) { for (auto n = *it; n > 0; --n) std::cout << "⏼" << ' '; std::cout << '\n'; } }
出力:
⏼ ⏼ ⏼ ⏼ ⏼ ⏼ ⏼ ⏼ ⏼ ⏼ ⏼ ⏼ ⏼ ⏼ ⏼ ⏼ ⏼ ⏼ ⏼ ⏼
関連項目
|
(C++11)
|
先頭を指す逆方向イテレータを返す
(public member function) |
|
(C++14)
|
コンテナまたは配列の終端を指す逆方向イテレータを返す
(function template) |