std::hive<T,Allocator>::empty
bool empty() const noexcept; | (since C++26) |
Checks if the container has no elements, i.e., whether begin() == end().
Return value
true if the container is empty, false otherwise.
Complexity
Constant.
Example
#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) |
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/cpp/container/hive/empty