Skip to content

Latest commit

 

History

History
67 lines (48 loc) · 1.13 KB

File metadata and controls

67 lines (48 loc) · 1.13 KB

cend

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

概要

末尾の次を指す読み取り専用イテレータを取得する。

戻り値

末尾の次を指す読み取り専用イテレータ

例外

投げない

備考

  • この関数によって返されるイテレータは、*thisが保持するいずれの要素も参照しない。その指す先は、不正な範囲となるだろう

#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;
  });
}
  • cend()[color ff0000]
  • ls.cbegin()[link cbegin.md]

出力

1
2
3

バージョン

言語

  • C++11

処理系

参照