std::flat_set::size(3)

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

πŸ’– NAME πŸ’–

std::flat_set::size - std::flat_set::size β€” yes bestie, the name is literally the name twice. This is the std::flat_set::size(3) page from the C++ Standard Libary manual, and we are keeping every detail, periodt.


✨ Synopsis ✨

size_type size() const noexcept;  (since C++23)

Returns the number of elements in the container adaptor. Equivalent to return c.size().

πŸŽ€ Parameters πŸŽ€

(none) β€” zero parameters, the parameter section is empty and thriving.

🫢 Return value 🫢

The number of elements in the container adaptor.

⚑ Complexity ⚑

Constant.

🌸 Example 🌸

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

// Run this code

#include <iostream>
#include <flat_set>

int main()
{
    std::flat_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 adaptor is empty (public member function)
  • size
  • ssize β€” returns the size of a container or array (function template)
  • (C++17), (C++20) β€” version tags listed in this See also block
  • max_size β€” returns the maximum possible number of elements (public member function)

source/version and date: http://cppreference.com Β· 2024.06.10 Β· page std::flat_set::size(3) β€” bye bestie, go count some elements πŸ’…βœ¨

πŸ“¦ where this page comes from