bool empty() const noexcept; // (1) C++26
概要
コンテナが空かどうかを判定する。
戻り値
コンテナが空であればtrue、そうでなければfalseを返す。
例外
投げない
計算量
定数時間
例
#include <hive>
#include <print>
int main()
{
// 空
{
std::hive<int> h;
std::println("{}", h.empty());
}
// 空じゃない
{
std::hive<int> h = {1, 2, 3};
std::println("{}", h.empty());
}
}
出力
true
false
バージョン
言語
- 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で