std::hive<T,Allocator>::empty
From cppreference.com
bool empty() const noexcept;
|
(since C++26) | |
Checks if the container has no elements, i.e., whether begin() == end().
Contents
Return value
true if the container is empty, false otherwise.
Complexity
Constant.
Example
Run this code
#include <hive>
#include <iostream>
int main()
{
std::cout << std::boolalpha;
std::hive<int> bees;
std::cout << "Initially, bees.empty() == " << bees.empty() << '\n';
bees.insert(00);
std::cout << "After adding elements, bees.empty() == " << bees.empty() << '\n';
}
Output:
Initially, bees.empty() == true
After adding elements, bees.empty() == false
See also
| returns the number of elements (public member function) | |
(C++17) |
checks whether the container is empty (function template) |