最終更新日時:
が更新

履歴 編集

function
<hive>

std::hive::crbegin(C++26)

const_reverse_iterator crbegin() const noexcept; // (1) C++26

概要

末尾要素を指す読み取り専用逆イテレータを取得する。

戻り値

末尾要素を指す読み取り専用逆イテレータ

例外

投げない

計算量

定数時間

#include <hive>
#include <print>

int main()
{
  std::hive<int> h;
  h.insert(1);
  h.insert(2);
  h.insert(3);

  // crbegin()/crend()で末尾から読み取り専用に逆順走査する
  for (auto it = h.crbegin(); it != h.crend(); ++it) {
    std::print("{} ", *it);
  }
  std::println("");
}

出力例

3 2 1 

バージョン

言語

  • C++26

処理系

参照