size_type size() const noexcept; // (1) C++26
概要
コンテナの要素数を取得する。
戻り値
要素数を返す。
例外
投げない
計算量
定数時間
例
#include <hive>
#include <print>
int main()
{
std::hive<int> h = {3, 1, 4, 5, 2};
std::println("{}", h.size());
}
出力
5
バージョン
言語
- C++26
処理系
- Clang: 22 ❌
- GCC: 16.1 ❌
- Visual C++: 2026 Update 2 ❌
関連項目
参照
- P0447R28 Introduction of
std::hiveto the standard library- C++26で
hiveが追加された
- C++26で