std::unorde...ltiset::size(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

πŸ’– std::unorde...ltiset::size(3) πŸ’–

okay bestie, welcome to the C++ Standard Libary manual page for std::unordered_multiset::size β€” yes, the header is literally std::unorde...ltiset::size(3) and we’re keeping the vibe. This is a C++11-and-later situation. 🫢


🌸 NAME 🌸

std::unordered_multiset::size - std::unordered_multiset::size, literally no cap.

✨ 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. πŸ™ˆ

πŸ¦‹ Return value πŸ¦‹

The number of elements in the container. That’s the whole mood. ✨

πŸ’œ Complexity πŸ’œ

Constant. O(1) energy, always iconic. πŸ‘‘

πŸ“ Example πŸ“

The following code uses size to display the number of elements in a std::unordered_multiset<int>:

// Run this code

#include <iostream>
#include <unordered_set>

int main()
{
    std::unordered_multiset<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)
  • size β€” listed in SEE ALSO
  • ssize β€” returns the size of a container or array
    • the original SEE ALSO block also shows (C++17), (function template), and (C++20)

okay that’s the whole page, bestie β€” go count your elements with confidence. πŸ’–

source: http://cppreference.com Β· version/page date: 2024.06.10 Β· page: std::unorde...ltiset::size(3) πŸŽ€

πŸ“¦ where this page comes from