std::unordered_set<Key,Hash,KeyEqual,Allocator>::empty
From cppreference.com
< cpp | container | unordered set
bool empty() const noexcept; |
(since C++11) (constexpr since C++26) |
|
Checks if the container has no elements.
Contents |
[edit] Return value
true if the container is empty, false otherwise.
[edit] Complexity
Constant.
[edit] Example
The following code uses empty to check if a std::unordered_set<int> contains any elements:
Run this code
#include <iostream> #include <unordered_set> int main() { std::unordered_set<int> numbers;