bool empty() const noexcept;
[[nodiscard]] bool empty() const noexcept; // C++20
bool empty() const noexcept; // C++26
概要
ノードハンドルが空であれば true
、そうでなければ false
を返す。
例
#include <iostream>
#include <set>
int main()
{
std::set<int>::node_type nh;
std::cout << std::boolalpha << nh.empty();
}
出力
true
バージョン
言語
- C++17
処理系
- Clang: 7.0.0 ✅
- GCC: 7.1.0 ✅
- ICC: ??
- Visual C++: 2017 Update 5 ✅
参照
- Splicing Maps and Sets(Revision 5)
- P0600R1
[[nodiscard]]
in the Library- C++20で
[[nodiscard]]
が付加された
- C++20で
- P2422R1 Remove
nodiscard
annotations from the standard library specification- C++26で
[[nodiscard]]
指定が削除された
- C++26で