Skip to content

Latest commit

 

History

History
63 lines (46 loc) · 1006 Bytes

cbegin.md

File metadata and controls

63 lines (46 loc) · 1006 Bytes

cbegin

  • list[meta header]
  • std[meta namespace]
  • list[meta class]
  • function[meta id-type]
  • cpp11[meta cpp]
const_iterator cbegin() const noexcept;

概要

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

戻り値

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

例外

投げない

#include <iostream>
#include <list>
#include <algorithm>

int main()
{
  std::list<int> ls = { 1, 2, 3 };

  // このアルゴリズム内ではlsの書き換えを決して行わない
  std::for_each(ls.cbegin(), ls.cend(), [](const int& x) {
    std::cout << x << std::endl;
  });
}
  • cbegin()[color ff0000]
  • ls.cend()[link cend.md]

出力

1
2
3

バージョン

言語

  • C++11

処理系

参照