最終更新日時(UTC):
が更新

履歴 編集

function
<flat_set>

std::flat_multiset::crbegin

const_reverse_iterator crbegin() const noexcept;

概要

コンテナ内の末尾を指す逆イテレータを取得する。 内部的に、このコンテナは各要素をキーの値に従って下位から上位へと並べており、従って crbegin() は最上位のキーにあたる値へのイテレータを返す。 crbegin()end() と同じ要素を指すわけではなく、その前の要素を指すことに注意。

戻り値

反転したシーケンスの先頭を指す逆イテレータ。 const_reverse_iterator はメンバ型である。このクラステンプレートにおいて、この型は逆ランダムアクセスイテレータであり、reverse_iterator<const_iterator> と定義される。

計算量

定数時間。

#include <flat_set>
#include <iostream>

int main()
{
  std::flat_multiset<int> fs = {3, 1, 4, 1};

  for (auto i = fs.crbegin(); i != fs.crend(); ++i) {
    std::cout << *i << std::endl;
  }
}

出力

4
3
1
1

バージョン

言語

  • C++23

処理系

関連項目

名前 説明
flat_multiset::begin 先頭を指すイテレータを取得する
flat_multiset::end 末尾の次を指すイテレータを取得する
flat_multiset::cbegin 先頭を指すconstイテレータを取得する
flat_multiset::cend 末尾の次を指すconstイテレータを取得する
flat_multiset::rbegin 末尾を指す逆イテレータを取得する
flat_multiset::rend 先頭の前を指す逆イテレータを取得する
flat_multiset::crend 先頭の前を指す逆constイテレータを取得する