std::multiset<Key,Compare,Allocator>::multiset
来自cppreference.com
                    
                                        
                    
                    
                                                            
                    
|   multiset(); explicit multiset( const Compare& comp,   | 
(1) | |
|   explicit multiset( const Allocator& alloc );  | 
(1) | (C++11 起) | 
| (2) | ||
|   template< class InputIt > multiset( InputIt first, InputIt last,  | 
||
|   template< class InputIt > multiset( InputIt first, InputIt last,  | 
(C++14 起) | |
|   multiset( const multiset& other );  | 
(3) | |
|   multiset( const multiset& other, const Allocator& alloc );  | 
(3) | (C++11 起) | 
|   multiset( multiset&& other );  | 
(4) | (C++11 起) | 
|   multiset( multiset&& other, const Allocator& alloc );  | 
(4) | (C++11 起) | 
| (5) | ||
|   multiset( std::initializer_list<value_type> init,           const Compare& comp = Compare(),  | 
(C++11 起) | |
|   multiset( std::initializer_list<value_type> init, const Allocator& );  | 
(C++14 起) | |
从各种数据源构造新容器,可选地使用用户提供的分配器 alloc 或比较函数对象 comp 。
1) 构造空容器。
2) 构造容器,使之拥有范围 
[first, last) 的内容。3) 复制构造函数。构造容器,使之拥有 
other 的内容副本。若不提供 alloc ,则通过调用 std::allocator_traits<allocator_type>::select_on_container_copy_construction(other.get_allocator()) 获得分配器。4) 移动构造函数。用移动语义构造容器,使之拥有 
other 的内容。若不提供 alloc ,则从属于 other 的分配器移动构造分配器5) 构造容器,使之拥有 initializer_list 
init 的内容。参数
| alloc | - | 用于此容器所有内存分配的分配器 | 
| comp | - | 用于所有关键比较的比较函数对象 | 
| first, last | - | 复制元素来源的范围 | 
| other | - | 要用作源以初始化容器元素的另一容器 | 
| init | - | 用以初始化容器元素的 initializer_list | 
| 类型要求 | ||
 -InputIt 必须满足遗留输入迭代器 (LegacyInputIterator)  的要求。
 | ||
 -Compare 必须满足比较 (Compare)  的要求。
 | ||
 -Allocator 必须满足分配器 (Allocator)  的要求。
 | ||
复杂度
1) 常数。
3) 与 
other 的大小成线性。4) 常数。若给定 
alloc 且 alloc != other.get_allocator() 则为线性。5) N log(N) ,其中通常有 N = init.size()) ,若 
init 已按照 value_comp() 排序则与 N 成线性 。异常
对 Allocator::allocate 的调用可能抛出。
注意
在容器移动构造(重载 (4) )后,指向 other 的引用及迭代器(除了尾迭代器)保持合法,但指代现于 *this 中的元素。当前标准由 [container.requirements.general]/12 中的总括陈述作出此保证,而 LWG 2321 正在考虑更严格的保证。
示例
| 本节未完成 原因:暂无示例  | 
缺陷报告
下列更改行为的缺陷报告追溯地应用于以前出版的 C++ 标准。
| DR | 应用于 | 出版时的行为 | 正确行为 | 
|---|---|---|---|
| LWG 2193 | C++11 | 默认构造函数为 explicit | 使之为非 explicit | 
参阅
|    赋值给容器   (公开成员函数)  |