std::flat_multiset<Key,Compare,KeyContainer>:: rbegin, std::flat_multiset<Key,Compare,KeyContainer>:: crbegin
|
reverse_iterator rbegin
(
)
noexcept
;
|
(1) |
(C++23以降)
(C++26以降 constexpr) |
|
const_reverse_iterator rbegin
(
)
const
noexcept
;
|
(2) |
(C++23以降)
(C++26以降 constexpr) |
|
const_reverse_iterator crbegin
(
)
const
noexcept
;
|
(3) |
(C++23以降)
(C++26以降 constexpr) |
反転された * this の最初の要素を指す逆方向イテレータを返します。これは非反転 * this の最後の要素に対応します。
* this が空の場合、返されるイテレータは rend() と等しくなります。
目次 |
戻り値
最初の要素への逆イテレータ。
計算量
定数。
注記
iterator
と
const_iterator
の両方が定数イテレータであるため(実際には同じ型である可能性もあります)、これらのメンバ関数によって返されるイテレータを通じてコンテナの要素を変更することはできません。
返された逆イテレータの 基盤イテレータ は 終端イテレータ です。したがって、終端イテレータが無効化された場合、返されたイテレータも無効化されます。
例
#include <iostream> #include <flat_set> int main() { std::flat_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++14)
|
コンテナまたは配列の先頭を指す逆方向イテレータを返す
(関数テンプレート) |