std::flat_multiset::empty(3)
π std::flat_multiset::empty(3) π
okay bestie, this little icon is from the C++ Standard Libary β yes that's the manual name, don't come for me π β and it's giving "do I have anything in here?" energy. Let's go β¨
β¨ NAME β¨
std::flat_multiset::empty β std::flat_multiset::empty (the NAME section said it twice, and honestly? double confirmation, slay π
)
β¨ Synopsis β¨
[[nodiscard]] bool empty() const noexcept; (since C++23)
Checks if the underlying container has no elements. Equivalent to return begin() == end();.
β¨ Parameters β¨
(none) β no params, no drama, we love a low-maintenance queen π«Ά
β¨ Return value β¨
true if the underlying container is empty, false otherwise. Periodt. β
β¨ Complexity β¨
Constant. β‘
β¨ Example β¨
The following code uses empty to check if a std::flat_multiset<int> contains any elements:
// Run this code
#include <iostream>
#include <flat_set>
int main()
{
std::flat_multiset<int> numbers;
std::cout << std::boolalpha;
std::cout << "Initially, numbers.empty(): " << numbers.empty() << '\n';
numbers.insert(42);
numbers.insert(19937);
std::cout << "After adding elements, numbers.empty(): " << numbers.empty() << '\n';
}
β¨ Output β¨
Initially, numbers.empty(): true
After adding elements, numbers.empty(): false
β¨ See also β¨
sizeβ returns the number of elements (public member function)emptyβ checks whether the container is empty (C++17) (function template)
mwah π signing off from http://cppreference.com with the date 2024.06.10, and yeah bestie this was std::flat_multiset::empty(3) β no cap, she ate πππ
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms