const_iterator cend() const noexcept; // (1) C++26
概要
末尾の次を指す読み取り専用イテレータを取得する。
このイテレータは、有効な要素を指さない終端を表す番兵として使用する。
戻り値
末尾の次を指す読み取り専用イテレータ
例外
投げない
計算量
定数時間
例
#include <hive>
#include <print>
int main()
{
std::hive<int> h;
h.insert(1);
h.insert(2);
h.insert(3);
// cbegin()/cend()で読み取り専用に走査する
for (auto it = h.cbegin(); it != h.cend(); ++it) {
std::print("{} ", *it);
}
std::println("");
}
出力例
1 2 3
バージョン
言語
- C++26
処理系
- Clang: 22 ❌
- GCC: 16.1 ❌
- Visual C++: 2026 Update 2 ❌