std::flat_set::count(3)
π
std::flat_set::count(3) π
okay bestie, welcome to std::flat_set::count(3) from the C++ Standard Libary (yes, that spelling, we're keeping it π). This one is short and iconic: it's all about counting matching keys. periodt. β¨
πΈ NAME πΈ
std::flat_set::count β std::flat_set::count
literally the same name twice, no cap. The manpage said it like that, so we're saying it like that. π«Ά
β¨ Synopsis β¨
size_type count( const Key& key ) const; (1) (since C++23)
template< class K > (2) (since C++23)
size_type count( const K& x ) const;
Returns the number of elements with key that compares equivalent to the specified argument. π
- Returns the number of elements with key
key. This is either1or0since this container does not allow duplicates. π - Returns the number of elements with key that compares equivalent to the value
x. This overload participates in overload resolution only if the qualified-idCompare::is_transparentis valid and denotes a type. It allows calling this function without constructing an instance ofKey. π§
π Parameters π
keyβ key value of the elements to countxβ alternative value to compare to the keys
π Return value π
Number of elements with key that compares equivalent to key or x, which, for overload (1), is either 1 or 0. π
π¦ Complexity π¦
Logarithmic in the size of the container plus linear in the number of elements found. So not free, but also not a whole saga. π
π Example π
This section is incomplete Reason: no example
no example bestie, they left us hanging π. That's literally what the page says, so we're not inventing one. π
π See also π
findβ finds element with specific key (public member function)equal_rangeβ returns range of elements matching a specific key (public member function)
these are your little search besties, go check them out π«Ά
π Category: π
* Todo no example
mood. π
mwah π this page came from http://cppreference.com, version/date 2024.06.10, and it's std::flat_set::count(3) β bye bestie, go count something! πβ¨
π¦ 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