std::multimap::size(3)
π NAME π
std::multimap::size - std::multimap::size β yes bestie, the NAME section in the original literally repeats itself, and honestly? Iconic. This page is from the C++ Standard Libary manual (typo is original, Iβm obsessed π).
β¨ Synopsis β¨
Hereβs the signature, copied exactly with the (noexcept since C++11) note:
size_type size() const; (noexcept since C++11)
This returns the number of elements in the container, i.e. std::distance(begin(), end()).
πΈ Parameters πΈ
(none) β no parameters, bestie. Zero. None. The parameter vibe check is empty.
π Return value π
The number of elements in the container.
π¦ Complexity π¦
Constant. Thatβs it β the original just says Constant, so weβre keeping that exact energy.
π₯ Example π₯
The following code uses size to display the number of elements in a std::multimap:
// Run this code
#include <iostream>
#include <map>
int main()
{
std::multimap<int,char> nums{{1, 'a'}, {3, 'b'}, {5, 'c'}, {7,
'd'}};
std::cout << "nums contains " << nums.size() << " elements.\n";
}
The line break after {7, is from the original man page, so weβre keeping the original code energy. π«Ά
β 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β the original lists this one bare, with no description attached; keeping it here so no reference goes missing πssizeβ returns the size of a container or array (function template); the original also has(C++17)and(C++20)markers hanging out in this See also area, and yes theyβre staying
π Thatβs the whole page, bestie. Source/version: http://cppreference.com, dated 2024.06.10. Go count your elements, periodt. π
π¦ 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