Skip to content

Latest commit

 

History

History
63 lines (47 loc) · 1.04 KB

cbegin.md

File metadata and controls

63 lines (47 loc) · 1.04 KB

cbegin

  • span[meta header]
  • std[meta namespace]
  • span[meta class]
  • function[meta id-type]
  • cpp23[meta cpp]
constexpr const_iterator cbegin() const noexcept;
  • const_iterator[link /reference/iterator/const_iterator.md]

概要

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

戻り値

return begin();
  • begin[link ./begin.md]

例外

投げない

#include <iostream>
#include <span>
#include <vector>

int main() {
  std::vector<int> v = {1, 2, 3, 4, 5};
  std::span<int, 5> sp{v};

  auto cit = sp.cbegin();

  std::cout << *cit << '\n';

  // これはできない
  // *cit = 0;
}
  • cbegin()[color ff0000]

出力

1

バージョン

言語

  • C++23

処理系

参照