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 |
先頭の前を指す逆イテレータを取得する |