std::flat_multiset(3)
π std::flat_multiset(3) π
okay bestie, welcome to the C++ Standard Libary manual page for std::flat_multiset β manual name folded in right at the top, header line not copied, we are living the vibe check. This page keeps every tiny detail, no cap. β¨
πΈ NAME πΈ
std::flat_multiset β std::flat_multiset. That's it, that's the name, periodt.
β¨ Synopsis β¨
Here's the exact spell, bestie:
Defined in header <flat_set>
template<
class Key,
class Compare = std::less<Key>, (since C++23)
class KeyContainer = std::vector<Key>
> class flat_multiset;
okay so flat_multiset is a container adaptor that gives the functionality of an associative container that stores a sorted set of objects of type Key. Unlike std::flat_set, multiple keys with equivalent values are allowed β yes, duplicates are the whole moment. Sorting is done using the key comparison function Compare.
The class template flat_multiset acts as a wrapper to the underlying sorted container passed as object of type KeyContainer.
Everywhere the standard library uses the Compare requirements, uniqueness is determined by using the equivalence relation. Informally, two objects a and b are considered equivalent if neither compares less than the other: !comp(a, b) && !comp(b, a).
std::flat_multiset meets the requirements of Container, ReversibleContainer, optional container requirements, and all requirements of AssociativeContainer (including logarithmic search complexity), except that:
- requirements related to nodes are not applicable,
- iterator invalidation requirements differ,
- the complexity of insertion and erasure operations is linear.
A flat multiset supports most AssociativeContainer's operations that use equal keys.
π§ Template parameters π§
Keyβ the type of the stored elements. The program is ill-formed ifKeyis not the same type asKeyContainer::value_type.Compareβ aComparetype providing a strict weak ordering.KeyContainerβ the type of the underlyingSequenceContainerto store the elements. The iterators of such container should satisfyLegacyRandomAccessIteratoror modelrandom_access_iterator. The standard containersstd::vectorandstd::dequesatisfy these requirements.
π Member types π
container_typeβKeyContainer.key_typeβKey.value_typeβKey.key_compareβCompare.value_compareβCompare.referenceβvalue_type&.const_referenceβconst value_type&.size_typeβtypename KeyContainer::size_type.difference_typeβtypename KeyContainer::difference_type.iteratorβ implementation-definedLegacyRandomAccessIteratorandrandom_access_iteratortovalue_type.const_iteratorβ implementation-definedLegacyRandomAccessIteratorandrandom_access_iteratortoconst value_type.reverse_iteratorβstd::reverse_iterator<iterator>.const_reverse_iteratorβstd::reverse_iterator<const_iterator>.
π Member objects π
c(private) β the underlying container ofcontainer_type(exposition-only member object*).compare(private) β the comparison function object of typekey_compare(exposition-only member object*).
π Member functions π
constructorβ constructs theflat_multiset(public member function).destructor(implicitly declared)β destroys every element of the container adaptor (public member function).operator=β assigns values to the container adaptor (public member function).
π Iterators π
beginβ returns an iterator to the beginning (public member function).cbeginβ public member function.endβ returns an iterator to the end (public member function).cendβ public member function.rbeginβ returns a reverse iterator to the beginning (public member function).crbeginβ public member function.rendβ returns a reverse iterator to the end (public member function).crendβ public member function.
π Capacity π
emptyβ checks whether the container adaptor is empty (public member function).sizeβ returns the number of elements (public member function).max_sizeβ returns the maximum possible number of elements (public member function).
π Modifiers π
emplaceβ constructs element in-place (public member function).emplace_hintβ constructs elements in-place using a hint (public member function).insertβ inserts elements (public member function).insert_rangeβ inserts a range of elements (public member function).extractβ extracts the underlying container (public member function).replaceβ replaces the underlying container (public member function).eraseβ erases elements (public member function).swapβ swaps the contents (public member function).clearβ clears the contents (public member function).
π₯ Lookup π₯
findβ finds element with specific key (public member function).countβ returns the number of elements matching specific key (public member function).containsβ checks if the container contains element with specific key (public member function).lower_boundβ returns an iterator to the first element not less than the given key (public member function).upper_boundβ returns an iterator to the first element greater than the given key (public member function).equal_rangeβ returns range of elements matching a specific key (public member function).
π Observers π
key_compβ returns the function that compares keys (public member function).value_compβ returns the function that compares keys in objects of typevalue_type(public member function).
π¦ Non-member functions π¦
operator==β lexicographically compares the values of twoflat_multisets (function template).operator<=>(C++23)β lexicographically compares the values of twoflat_multisets (function template).std::swap(std::flat_multiset)(C++23)β specializes thestd::swapalgorithm (function template).erase_if(std::flat_multiset)(C++23)β erases all elements satisfying specific criteria (function template).
πΈ Helper classes πΈ
std::uses_allocator<std::flat_multiset>(C++23)β specializes thestd::uses_allocatortype trait (class template specialization).
π·οΈ Tags π·οΈ
sorted_equivalent(C++23)β indicates that elements of a range are sorted (uniqueness is not required) (tag).sorted_equivalent_t(C++23)β (tag).
β¨ Deduction guides β¨
The page has this heading but no entries listed under it, bestie β nothing to copy here.
π Notes π
The member types iterator and const_iterator may be aliases to the same type. This means defining a pair of function overloads using the two types as parameter types may violate the One Definition Rule. Since iterator is convertible to const_iterator, a single function with const_iterator as parameter type will work instead.
Feature-test macro:
__cpp_lib_flat_setβ value202207L, std(C++23), feature:std::flat_setandstd::flat_multiset.
π Example π
This section is incomplete. Reason: no example.
β See also β
flat_set(C++23)β adapts a container to provide a collection of unique keys, sorted by keys (class template).multisetβ collection of keys, sorted by keys (class template).unordered_multiset(C++11)β collection of keys, hashed by keys (class template).
π§ Categories π§
- Todo without reason
- Todo no example
mwah π β this page came from http://cppreference.com, dated 2024.06.10, and its manual handle is std::flat_multiset(3). bye bestie, go slay some sorted duplicates π
β¨
π¦ 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