◐ Shell
clean mode source ↗

std::hive<T,Allocator>::empty - cppreference.com

From cppreference.com

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) [edit]
checks whether the container is empty
(function template) [edit]