最終更新日時(UTC):
が更新

履歴 編集

function
<set>

std::multiset::cbegin(C++11)

const_iterator cbegin() const noexcept;

概要

multiset コンテナの先頭要素を参照する読み取り専用イテレータを取得する。

戻り値

コンテナの先頭要素への読み取り専用イテレータ。

計算量

定数時間。

#include <iostream>
#include <set>
#include <algorithm>

int main()
{
  std::multiset<int> c = {1, 1, 2};

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

出力

1
1
2

関連項目

名前 説明
multiset::cend 末尾の次を指す読み取り専用イテレータを取得する
multuset::rbegin 末尾を指す逆イテレータを取得する
multiset::rend 先頭の前を指す逆イテレータを取得する