std::flat_multiset<Key,Compare,KeyContainer>::flat_multiset - cppreference.com (original) (raw)
| flat_multiset() : flat_multiset(key_compare()) { } | (1) | (since C++23) |
|---|---|---|
| template< class Allocator >flat_multiset( const flat_multiset& other, const Allocator& alloc ); | (2) | (since C++23) |
| template< class Allocator >flat_multiset( flat_multiset&& other, const Allocator& alloc ); | (3) | (since C++23) |
| explicit flat_multiset( container_type cont, const key_compare& comp = key_compare() ); | (4) | (since C++23) |
| template< class Allocator >flat_multiset( const container_type& cont, const Allocator& alloc ); | (5) | (since C++23) |
| template< class Allocator > flat_multiset( const container_type& cont, const key_compare& comp, const Allocator& alloc ); | (6) | (since C++23) |
| flat_multiset( std::sorted_equivalent_t s, container_type cont, const key_compare& comp = key_compare() ) : c(std::move(cont)), compare(comp) { } | (7) | (since C++23) |
| template< class Allocator > flat_multiset( std::sorted_equivalent_t s, const container_type& cont, const Allocator& alloc ); | (8) | (since C++23) |
| template< class Allocator > flat_multiset( std::sorted_equivalent_t s, const container_type& cont, const key_compare& comp, const Allocator& alloc ); | (9) | (since C++23) |
| explicit flat_multiset( const key_compare& comp ) : c(), compare(comp) { } | (10) | (since C++23) |
| template< class Allocator >flat_multiset( const key_compare& comp, const Allocator& alloc ); | (11) | (since C++23) |
| template< class Allocator > explicit flat_multiset( const Allocator& alloc ); | (12) | (since C++23) |
| template< class InputIter > flat_multiset( InputIter first, InputIter last, const key_compare& comp = key_compare() ) : c(), compare(comp); | (13) | (since C++23) |
| template< class InputIter, class Allocator > flat_multiset( InputIter first, InputIter last, const key_compare& comp, const Allocator& alloc ); | (14) | (since C++23) |
| template< class InputIter, class Allocator >flat_multiset( InputIter first, InputIter last, const Allocator& alloc ); | (15) | (since C++23) |
| template< container-compatible-range<value_type> R > flat_multiset( std::from_range_t, R&& rg, const key_compare& comp ) : flat_multiset(comp); | (16) | (since C++23) |
| template< container-compatible-range<value_type> R > flat_multiset( std::from_range_t fr, R&& rg ) : flat_multiset( fr, std::forward<R>(rg), key_compare() ) { } | (17) | (since C++23) |
| template< container-compatible-range<value_type> R, class Allocator >flat_multiset( std::from_range_t, R&& rg, const Allocator& alloc ); | (18) | (since C++23) |
| template< container-compatible-range<value_type> R, class Allocator > flat_multiset( std::from_range_t, R&& rg, const key_compare& comp, const Allocator& alloc ); | (19) | (since C++23) |
| template< class InputIter > flat_multiset( std::sorted_equivalent_t s, InputIter first, InputIter last, const key_compare& comp = key_compare() ) : c(first, last), compare(comp) { } | (20) | (since C++23) |
| template< class InputIter, class Allocator > flat_multiset( std::sorted_equivalent_t s, InputIter first, InputIter last, const key_compare& comp, const Allocator& alloc ); | (21) | (since C++23) |
| template< class InputIter, class Allocator > flat_multiset( std::sorted_equivalent_t s, InputIter first, InputIter last, const Allocator& alloc ); | (22) | (since C++23) |
| flat_multiset( std::initializer_list<value_type> init, const key_compare& comp = key_compare() ) : flat_multiset(init.begin(), init.end(), comp) { } | (23) | (since C++23) |
| template< class Allocator > flat_multiset( std::initializer_list<value_type> init, const key_compare& comp, const Allocator& alloc ); | (24) | (since C++23) |
| template< class Allocator >flat_multiset( std::initializer_list<value_type> init, const Allocator& alloc ); | (25) | (since C++23) |
| flat_multiset( std::sorted_equivalent_t s, std::initializer_list<value_type> init, const key_compare& comp = key_compare() ) : flat_multiset(s, init.begin(), init.end(), comp) { } | (26) | (since C++23) |
| template< class Allocator > flat_multiset( std::sorted_equivalent_t s, std::initializer_list<value_type> init, const key_compare& comp, const Allocator& alloc ); | (27) | (since C++23) |
| template< class Allocator > flat_multiset( std::sorted_equivalent_t s, std::initializer_list<value_type> init, const Allocator& alloc ); | (28) | (since C++23) |
Constructs new container adaptor from a variety of data sources and optionally provided comparison function object comp and/or allocator alloc.
A default constructor. Constructs an empty container adaptor.
Constructs the underlying container with the contents of the container cont. First, initializes c with std::move(cont) and compare with comp. Then sorts the c with respect to
comp.Same as (4), equivalent to flat_multiset(cont);. See allocator usage note below.
Same as (4), equivalent to flat_multiset(cont, comp);. See allocator usage note below.
Constructs the underlying container with the contents of the other container cont. Initializes c with std::move(cont) and compare with comp.
Same as (7), equivalent to flat_multiset(s, cont);. See allocator usage note below.
Same as (7), equivalent to flat_multiset(s, cont, comp);. See allocator usage note below.
Constructs an empty container adaptor.
Constructs the container adaptor with the contents of the range
[first,last), equivalent to insert(first, last);.Constructs the container adaptor with the contents of the range rg. First, uses (10) as delegating constructor. Then initializes c with the contents of rg as if by insert_range(std::forward<R>(rg));.
Constructs the underlying container with the contents of the range
[first,last). Initializes c with c(first, last) and compare with compare(comp).
Note for overloads (13-15,20-22): If [first, last) is not a valid range, the behavior is undefined.
Contents
[edit] Allocator usage note
The constructors (2,3,5,6,8,9,11,12,14,15,17,19,21,22,24,25,27,28) are equivalent to the corresponding non-allocator constructors except that c is constructed with uses-allocator construction. These overloads participate in overload resolution only if std::uses_allocator_v<container_type, Allocator> is true.
[edit] Parameters
| cont | - | a container to be used as source to initialize the underlying container |
|---|---|---|
| other | - | another flat_multiset to be used as source to initialize the elements of the underlying container with |
| alloc | - | an allocator to use for all memory allocations of the underlying container |
| comp | - | a function object to be used for all comparisons of keys |
| first, last | - | the pair of iterators defining the source range of elements to copy |
| init | - | an initializer list to initialize the elements of the underlying container with |
| rg | - | a container compatible range (that is, an input_range whose elements are convertible to value_type) to be used as source to initialize the underlying container |
| fr | - | a disambiguation tag that indicates that the contained member should be range constructed |
| s | - | a disambiguation tag that indicates that the input sequence is sorted with respect to compare |
| Type requirements | ||
| -InputIt must meet the requirements of LegacyInputIterator. | ||
| -Compare must meet the requirements of Compare. | ||
| -Allocator must meet the requirements of Allocator. |
[edit] Complexity
Constant.
Linear in size of other.
Same as the corresponding move-constructor of the wrapped container, i.e. constant or linear in size of cont.
4-6) Linear in \(\scriptsize N\)N if cont is sorted with respect to compare, otherwise \(\scriptsize \mathcal{O}(N\cdot\log{(N)})\)𝓞(N·log(N)), where \(\scriptsize N\)N is the value of cont.size() before this call.
7-9) Same as the corresponding move-constructor of the wrapped container, i.e. constant or linear in size of cont.
10-12) Constant.
13-15) Linear in \(\scriptsize N\)N if the input range [first, last) is sorted with respect to compare, otherwise \(\scriptsize \mathcal{O}(N\cdot\log{(N)})\)𝓞(N·log(N)), where \(\scriptsize N\)N is the value of cont.size() before this call.
16-19) Linear in \(\scriptsize N\)N if the input range rg is sorted with respect to compare, otherwise \(\scriptsize \mathcal{O}(N\cdot\log{(N)})\)𝓞(N·log(N)), where \(\scriptsize N\)N is the value of cont.size() before this call.
20-22) Linear in size of [first, last).
23-25) Linear in \(\scriptsize N\)N if the elements of init are sorted with respect to compare, otherwise \(\scriptsize \mathcal{O}(N\cdot\log{(N)})\)𝓞(N·log(N)), where \(\scriptsize N\)N is the value of cont.size() before this call.
26-28) Linear in size of init.
[edit] Exceptions
Calls to Allocator::allocate may throw.
[edit] Notes
After container move construction (overload (3)), references, pointers, and iterators (other than the end iterator) to other remain valid, but refer to elements that are now in *this. The current standard makes this guarantee via the blanket statement in [container.reqmts]/67, and a more direct guarantee is under consideration via LWG issue 2321.
[edit] Example
[edit] See also
| | assigns values to the container adaptor (public member function) [edit] | | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |