std::flat_set<Key,Compare,KeyContainer>::rend, std::flat_set<Key,Compare,KeyContainer>::crend
From cppreference.com
| reverse_iterator rend() noexcept; |
(1) | (C++23から) |
| const_reverse_iterator rend() const noexcept; |
(2) | (C++23から) |
| const_reverse_iterator crend() const noexcept; |
(3) | (C++23から) |
逆順にされたflat_setの最後の要素の次の要素を指す逆イテレータを返します。これは、通常の順序のflat_setの最初の要素の前の要素に対応します。この要素はプレースホルダーとして機能し、アクセスしようとすると未定義の動作が発生します。
目次 |
[編集] 戻り値
最後の要素の次の要素へのリバースイテレータ。
[編集] 複雑性
定数。
注釈
iterator と const_iterator の両方が定数イテレータであるため(実際には同じ型である可能性もあります)、これらのメンバ関数のいずれかによって返されたイテレータを通じてコンテナの要素を変更することはできません。
[編集] 例
このコードを実行
#include <iostream> #include <flat_set> int main() { std::flat_set<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'; } }
出力
⏼ ⏼ ⏼ ⏼ ⏼ ⏼ ⏼ ⏼ ⏼ ⏼
[編集] 関連項目
| 先頭への逆イテレータを返す (public メンバ関数) | |
| (C++14) |
コンテナまたは配列の逆順の終端イテレータを返す (function template) |