std::flat_map::empty(3)
okay so bestie, this is the std::flat_map::empty(3) page from the C++ Standard Libary manual β tiny page, big main character energy π
β¨
π NAME π
std::flat_map::empty - std::flat_map::empty β literally the name, no notes ππ
β¨ Synopsis β¨
[[nodiscard]] bool empty() const noexcept; (since C++23)
Checks if the underlying containers have no elements. Equivalent to return begin() == end();. π«Ά
πΈ Parameters πΈ
(none) β not a single parameter, bestie π
π Return value π
true if the underlying containers are empty, false otherwise. Periodt. β¨
β‘ Complexity β‘
Constant. β‘ No drama, no scaling, just constant.
π¦ Example π¦
The following code uses empty to check if a std::flat_map<int, int> contains any elements:
// Run this code
#include <iostream>
#include <flat_map>
#include <utility>
int main()
{
std::flat_map<int,int> numbers;
std::cout << std::boolalpha;
std::cout << "Initially, numbers.empty(): " << numbers.empty() <<
'\n';
numbers.emplace(42, 13);
numbers.insert(std::make_pair(13317, 123));
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 π source/version/date: http://cppreference.com Β· 2024.06.10 Β· std::flat_map::empty(3) β that's the footer tea, bestie π§π
π¦ 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