最終更新日時:
が更新

履歴 編集

function
<hive>

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

const_iterator cbegin() const noexcept; // (1) C++26

概要

先頭要素を指す読み取り専用イテレータを取得する。

戻り値

先頭要素を指す読み取り専用イテレータ

例外

投げない

計算量

定数時間

#include <hive>
#include <print>

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

  // cbegin()/cend()で読み取り専用に走査する
  for (auto it = h.cbegin(); it != h.cend(); ++it) {
    std::print("{} ", *it);
  }
  std::println("");
}

出力例

1 2 3 

バージョン

言語

  • C++26

処理系

参照