std::unordered_set::size(3)
std::unordered_set::size(3) π
okay so bestie π this is the C++ Standard Libary manual page for std::unordered_set::size, and it is literally the "how many things are in this container" button. No cap.
NAME π
std::unordered_set::size - std::unordered_set::size
Synopsis π¦
size_type size() const noexcept; (since C++11)
Returns the number of elements in the container, i.e. std::distance(begin(), end()).
Parameters π
(none) β not a single parameter, bestie. The vibe check is empty, and that's iconic.
Return value πΈ
The number of elements in the container. That's it. That's the whole gift π«Ά.
Complexity β
Constant.
Example π
The following code uses size to display the number of elements in a std::unordered_set<int>:
// Run this code
#include <iostream>
#include <unordered_set>
int main()
{
std::unordered_set<int> nums{1, 3, 5, 7};
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)sizessizeβ returns the size of a container or array(C++17)β(function template)(C++20)
mwah π this page is from http://cppreference.com and dated 2024.06.10.
π¦ 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