最終更新日時:
が更新

履歴 編集

function
<hive>

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

reverse_iterator rend() noexcept;             // (1) C++26
const_reverse_iterator rend() const noexcept; // (2) C++26

概要

先頭の前を指す逆イテレータを取得する。

このイテレータは、逆順走査における終端を表す番兵として使用する。

戻り値

先頭の前を指す逆イテレータ

例外

投げない

計算量

定数時間

#include <hive>
#include <print>

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

  // rbegin()からrend()まで末尾から逆順に走査する
  for (auto it = h.rbegin(); it != h.rend(); ++it) {
    std::print("{} ", *it);
  }
  std::println("");
}

出力例

3 2 1 

バージョン

言語

  • C++26

処理系

参照