std::unorde...imap::empty(3)
πΈ NAME πΈ
okay bestie, welcome to the std::unordered_multimap::empty(3) page π
the header is std::unorde...imap::empty(3) and the manual name is C++ Standard Libary β yes, that spelling, we're keeping it π«Ά
Name line energy: std::unordered_multimap::empty - std::unordered_multimap::empty. It's the member function that checks whether your std::unordered_multimap has no elements. That's the whole name, and it's serving exactly what it says β¨
π¦ Synopsis π¦
Okay so here's the signature tea, bestie:
bool empty() const noexcept; (since C++11)
(until C++20)
[[nodiscard]] bool empty() const noexcept; (since C++20)
The plain bool empty() const noexcept; form is (since C++11) and (until C++20). The [[nodiscard]] bool empty() const noexcept; form is (since C++20). Both are const noexcept, and the [[nodiscard]] is right there in the signature π
This is literally the checks line: it checks if the container has no elements, i.e. whether begin() == end() π
π Parameters π
Parameters: (none). That's the whole section, bestie. Zero params, no drama, no little argument side quests π
π Return value π
true if the container is empty, false otherwise. That's it β boolean main character energy β
π₯ Complexity π₯
Constant. That's the entire complexity section. Constant. No cap, fr fr π
π¦ Example π¦
The following code uses empty to check if a std::unordered_multimap<int, int> contains any elements:
// Run this code
#include <iostream>
#include <unordered_map>
#include <utility>
int main()
{
std::unordered_multimap<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)
made with π from http://cppreference.com Β· version/date 2024.06.10 Β· page std::unorde...imap::empty(3) π«Ά
π¦ 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