flat_multiset()
: flat_multiset(key_compare()) { }
|
(1) |
(C++23 起) |
template< class Allocator >
flat_multiset( const flat_multiset& other, const Allocator& alloc );
|
(2) |
(C++23 起) |
template< class Allocator >
flat_multiset( flat_multiset&& other, const Allocator& alloc );
|
(3) |
(C++23 起) |
explicit flat_multiset( container_type cont,
const key_compare& comp = key_compare() );
|
(4) |
(C++23 起) |
template< class Allocator >
flat_multiset( const container_type& cont, const Allocator& alloc );
|
(5) |
(C++23 起) |
template< class Allocator >
flat_multiset( const container_type& cont, const key_compare& comp,
const Allocator& alloc );
|
(6) |
(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) |
(C++23 起) |
template< class Allocator >
flat_multiset( std::sorted_equivalent_t s, const container_type& cont,
const Allocator& alloc );
|
(8) |
(C++23 起) |
template< class Allocator >
flat_multiset( std::sorted_equivalent_t s, const container_type& cont,
const key_compare& comp, const Allocator& alloc );
|
(9) |
(C++23 起) |
explicit flat_multiset( const key_compare& comp )
: c(), compare(comp) { }
|
(10) |
(C++23 起) |
template< class Allocator >
flat_multiset( const key_compare& comp, const Allocator& alloc );
|
(11) |
(C++23 起) |
template< class Allocator >
explicit flat_multiset( const Allocator& alloc );
|
(12) |
(C++23 起) |
template< class InputIter >
flat_multiset( InputIter first, InputIter last,
const key_compare& comp = key_compare() )
: c(), compare(comp);
|
(13) |
(C++23 起) |
template< class InputIter, class Allocator >
flat_multiset( InputIter first, InputIter last,
const key_compare& comp, const Allocator& alloc );
|
(14) |
(C++23 起) |
template< class InputIter, class Allocator >
flat_multiset( InputIter first, InputIter last, const Allocator& alloc );
|
(15) |
(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) |
(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) |
(C++23 起) |
template< container-compatible-range<value_type> R, class Allocator >
flat_multiset( std::from_range_t, R&& rg, const Allocator& alloc );
|
(18) |
(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) |
(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) |
(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) |
(C++23 起) |
template< class InputIter, class Allocator >
flat_multiset( std::sorted_equivalent_t s, InputIter first, InputIter last,
const Allocator& alloc );
|
(22) |
(C++23 起) |
flat_multiset( std::initializer_list<value_type> init,
const key_compare& comp = key_compare() )
: flat_multiset(init.begin(), init.end(), comp) { }
|
(23) |
(C++23 起) |
template< class Allocator >
flat_multiset( std::initializer_list<value_type> init, const key_compare& comp,
const Allocator& alloc );
|
(24) |
(C++23 起) |
template< class Allocator >
flat_multiset( std::initializer_list<value_type> init, const Allocator& alloc );
|
(25) |
(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) |
(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) |
(C++23 起) |
template< class Allocator >
flat_multiset( std::sorted_equivalent_t s, std::initializer_list<value_type> init,
const Allocator& alloc );
|
(28) |
(C++23 起) |
| | |
从各种数据源构造新的容器适配器,可选地使用用户提供的比较函数对象 comp 或分配器 alloc。
1) 默认构造函数。构造空容器适配器。
4) 以容器
cont 的内容构造底层容器。首先,以
std::move(cont) 初始化
c,并以
comp初始化
compare。然后根据
comp 对
c 排序。
5) 同
(4),等价于
flat_multiset(cont);。
参见下文的
分配器用法注解。
6) 同
(4),等价于
flat_multiset(cont, comp);。
参见下文的
分配器用法注解。
7) 以另一容器
cont 的内容构造底层容器。以
std::move(cont) 初始化
c,并以
comp初始化
compare。
8) 同
(7),等价于
flat_multiset(s, cont);。
参见下文的
分配器用法注解。
9) 同
(7),等价于
flat_multiset(s, cont, comp);。
参见下文的
分配器用法注解。
10) 构造空容器适配器。
13) 以范围 [first, last) 的内容构造容器适配器,等价于 insert(first, last);。
16) 以范围
rg 的内容构造容器适配器。首先,将
(10) 用作
委托构造函数。然后以
rg 的内容初始化
c,如同
insert_range(std::forward<R>(rg));。
20) 以范围
[first, last) 的内容构造容器适配器。以
c(first, last) 初始化
c,并以
compare(comp) 初始化
compare。
针对重载 (13-15,20-22) 的注解:如果 [first, last) 不是有效范围,则行为未定义。
分配器用法注解
构造函数 (2,3,5,6,8,9,11,12,14,15,17,19,21,22,24,25,27,28) 等价于对应的无分配器构造函数,但 c 采用使用分配器构造。
仅当 std::uses_allocator_v<container_type, Allocator> 为 true 时,这些重载才参与重载决议。
参数
复杂度
1) 常数。
2) 与 other 的大小成线性。
3) 与被包装容器的对应移动构造函数相同,即为常数或与 cont 的大小成线性。
4-6) 当 cont 按 compare 有序时与 \(\scriptsize N\)N 成线性,否则为 \(\scriptsize \mathcal{O}(N\cdot\log{(N)})\)𝓞(N·log(N)),其中 \(\scriptsize N\)N 是此次调用前 cont.size() 的值。
7-9) 与被包装容器的对应移动构造函数相同,即为常数或与 cont 的大小成线性。
10-12) 常数。
13-15) 当输入范围 [first, last) 按 compare 有序时与 \(\scriptsize N\)N 成线性,否则为 \(\scriptsize \mathcal{O}(N\cdot\log{(N)})\)𝓞(N·log(N)),其中 \(\scriptsize N\)N 是此次调用前 cont.size() 的值。
16-19) 当输入范围 rg 按 compare 有序时与 \(\scriptsize N\)N 成线性,否则为 \(\scriptsize \mathcal{O}(N\cdot\log{(N)})\)𝓞(N·log(N)),其中 \(\scriptsize N\)N 是此次调用前 cont.size() 的值。
20-22) 与 [first, last) 的大小成线性。
23-25) 当 init 的元素按 compare 有序时与 \(\scriptsize N\)N 成线性,否则为 \(\scriptsize \mathcal{O}(N\cdot\log{(N)})\)𝓞(N·log(N)),其中 \(\scriptsize N\)N 是此次调用前 cont.size() 的值。
26-28) 与 init 的大小成线性。
异常
调用 Allocator::allocate 可能抛出异常。
注解
在容器移动构造(重载 (3,16-19))后,指向 other 的引用及迭代器(除了尾迭代器)保持合法,但将指代现于 *this 中的元素。当前标准由 [container.requirements.general]/12 中的总括陈述作出此保证,而 LWG 问题 2321 正在考虑更严格的保证。
示例
参阅