std::unorde...ltimap::size(3)
π std::unorde...ltimap::size(3) π
okay so bestie, welcome to the C++ Standard Libary manual β yes, βLibaryβ is literally how the header spells it, and weβre not fixing it, weβre respecting the icon behavior. π The title up top is the truncated-looking std::unorde...ltimap::size(3), and this whole page is about std::unordered_multimap::size. Itβs lowkey the easiest win in the entire container world. π«Ά
πΈ NAME πΈ
std::unordered_multimap::size β std::unordered_multimap::size
thatβs it, thatβs the name, no notes π
β¨ Synopsis β¨
size_type size() const noexcept; (since C++11)
So you call .size() on your std::unordered_multimap, and it returns the number of elements in the container, i.e. std::distance(begin(), end()). periodt. β¨
π Parameters π
(none) β not a single argument, not a secret optional vibe, nothing. π
π Return value π
The number of elements in the container. Thatβs the whole tea. π
π¦ Complexity π¦
Constant. fr fr. π
π₯ Example π₯
The following code uses size to display the number of elements in a std::unordered_multimap.
The page also drops a little // Run this code marker right before the block:
#include <iostream>
#include <unordered_map>
int main()
{
std::unordered_multimap<int,char> nums{{1, 'a'}, {3, 'b'}, {5, 'c'}, {7, 'd'}};
std::cout << "nums contains " << nums.size() << " elements.\n";
}
β Output β
nums contains 4 elements.
π See also π
emptyβ checks whether the container is empty(public member function)max_sizeβ returns the maximum possible number of elements(public member function)sizeβ(C++17)β the original places it right above the sharedreturns the size of a container or arraydescriptionssizeβ returns the size of a container or array(function template)(C++20)
and thatβs the whole page, bestie! footer vibes, lovingly preserved: source http://cppreference.com, date 2024.06.10, and title std::unorde...ltimap::size(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