56 #ifndef _STL_MULTISET_H
57 #define _STL_MULTISET_H 1
60 #if __cplusplus >= 201103L
64 namespace std _GLIBCXX_VISIBILITY(default)
66 _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
90 template <
typename _Key,
typename _Compare = std::less<_Key>,
91 typename _Alloc = std::allocator<_Key> >
95 typedef typename _Alloc::value_type _Alloc_value_type;
96 __glibcxx_class_requires(_Key, _SGIAssignableConcept)
97 __glibcxx_class_requires4(_Compare,
bool, _Key, _Key,
98 _BinaryFunctionConcept)
99 __glibcxx_class_requires2(_Key, _Alloc_value_type, _SameTypeConcept)
103 typedef _Key key_type;
104 typedef _Key value_type;
105 typedef _Compare key_compare;
106 typedef _Compare value_compare;
107 typedef _Alloc allocator_type;
112 rebind<_Key>::other _Key_alloc_type;
114 typedef _Rb_tree<key_type, value_type, _Identity<value_type>,
115 key_compare, _Key_alloc_type> _Rep_type;
122 typedef typename _Alloc_traits::pointer pointer;
123 typedef typename _Alloc_traits::const_pointer const_pointer;
124 typedef typename _Alloc_traits::reference reference;
125 typedef typename _Alloc_traits::const_reference const_reference;
129 typedef typename _Rep_type::const_iterator iterator;
130 typedef typename _Rep_type::const_iterator const_iterator;
133 typedef typename _Rep_type::size_type size_type;
134 typedef typename _Rep_type::difference_type difference_type;
141 _GLIBCXX_NOEXCEPT_IF(
142 is_nothrow_default_constructible<allocator_type>::value
143 && is_nothrow_default_constructible<key_compare>::value)
153 const allocator_type& __a = allocator_type())
154 : _M_t(__comp, _Key_alloc_type(__a)) { }
165 template<
typename _InputIterator>
166 multiset(_InputIterator __first, _InputIterator __last)
168 { _M_t._M_insert_equal(__first, __last); }
181 template<
typename _InputIterator>
182 multiset(_InputIterator __first, _InputIterator __last,
183 const _Compare& __comp,
184 const allocator_type& __a = allocator_type())
185 : _M_t(__comp, _Key_alloc_type(__a))
186 { _M_t._M_insert_equal(__first, __last); }
198 #if __cplusplus >= 201103L
207 noexcept(is_nothrow_copy_constructible<_Compare>::value)
208 : _M_t(
std::move(__x._M_t)) { }
221 const _Compare& __comp = _Compare(),
222 const allocator_type& __a = allocator_type())
223 : _M_t(__comp, _Key_alloc_type(__a))
224 { _M_t._M_insert_equal(__l.begin(), __l.end()); }
229 : _M_t(_Compare(), _Key_alloc_type(__a)) { }
233 : _M_t(__m._M_t, _Key_alloc_type(__a)) { }
237 noexcept(is_nothrow_copy_constructible<_Compare>::value
238 && _Alloc_traits::_S_always_equal())
239 : _M_t(
std::move(__m._M_t), _Key_alloc_type(__a)) { }
243 : _M_t(_Compare(), _Key_alloc_type(__a))
244 { _M_t._M_insert_equal(__l.begin(), __l.end()); }
247 template<
typename _InputIterator>
248 multiset(_InputIterator __first, _InputIterator __last,
249 const allocator_type& __a)
250 : _M_t(_Compare(), _Key_alloc_type(__a))
251 { _M_t._M_insert_equal(__first, __last); }
268 #if __cplusplus >= 201103L
287 _M_t._M_assign_equal(__l.begin(), __l.end());
297 {
return _M_t.key_comp(); }
301 {
return _M_t.key_comp(); }
305 {
return allocator_type(_M_t.get_allocator()); }
314 {
return _M_t.begin(); }
322 end() const _GLIBCXX_NOEXCEPT
323 {
return _M_t.end(); }
332 {
return _M_t.rbegin(); }
341 {
return _M_t.rend(); }
343 #if __cplusplus >= 201103L
351 {
return _M_t.begin(); }
360 {
return _M_t.end(); }
369 {
return _M_t.rbegin(); }
378 {
return _M_t.rend(); }
384 {
return _M_t.empty(); }
389 {
return _M_t.size(); }
394 {
return _M_t.max_size(); }
409 _GLIBCXX_NOEXCEPT_IF(__is_nothrow_swappable<_Compare>::value)
410 { _M_t.swap(__x._M_t); }
413 #if __cplusplus >= 201103L
426 template<
typename... _Args>
429 {
return _M_t._M_emplace_equal(std::forward<_Args>(__args)...); }
452 template<
typename... _Args>
456 return _M_t._M_emplace_hint_equal(__pos,
457 std::forward<_Args>(__args)...);
474 {
return _M_t._M_insert_equal(__x); }
476 #if __cplusplus >= 201103L
479 {
return _M_t._M_insert_equal(std::move(__x)); }
503 insert(const_iterator __position,
const value_type& __x)
504 {
return _M_t._M_insert_equal_(__position, __x); }
506 #if __cplusplus >= 201103L
508 insert(const_iterator __position, value_type&& __x)
509 {
return _M_t._M_insert_equal_(__position, std::move(__x)); }
520 template<
typename _InputIterator>
522 insert(_InputIterator __first, _InputIterator __last)
523 { _M_t._M_insert_equal(__first, __last); }
525 #if __cplusplus >= 201103L
535 { this->
insert(__l.begin(), __l.end()); }
538 #if __cplusplus >= 201103L
554 _GLIBCXX_ABI_TAG_CXX11
557 {
return _M_t.erase(__position); }
571 { _M_t.erase(__position); }
587 {
return _M_t.erase(__x); }
589 #if __cplusplus >= 201103L
606 _GLIBCXX_ABI_TAG_CXX11
608 erase(const_iterator __first, const_iterator __last)
609 {
return _M_t.erase(__first, __last); }
625 { _M_t.erase(__first, __last); }
648 {
return _M_t.count(__x); }
650 #if __cplusplus > 201103L
651 template<
typename _Kt>
653 count(
const _Kt& __x)
const -> decltype(_M_t._M_count_tr(__x))
654 {
return _M_t._M_count_tr(__x); }
674 {
return _M_t.find(__x); }
677 find(
const key_type& __x)
const
678 {
return _M_t.find(__x); }
680 #if __cplusplus > 201103L
681 template<
typename _Kt>
684 -> decltype(iterator{_M_t._M_find_tr(__x)})
685 {
return iterator{_M_t._M_find_tr(__x)}; }
687 template<
typename _Kt>
689 find(
const _Kt& __x)
const
690 -> decltype(const_iterator{_M_t._M_find_tr(__x)})
691 {
return const_iterator{_M_t._M_find_tr(__x)}; }
709 {
return _M_t.lower_bound(__x); }
713 {
return _M_t.lower_bound(__x); }
715 #if __cplusplus > 201103L
716 template<
typename _Kt>
719 -> decltype(iterator(_M_t._M_lower_bound_tr(__x)))
720 {
return iterator(_M_t._M_lower_bound_tr(__x)); }
722 template<
typename _Kt>
725 -> decltype(iterator(_M_t._M_lower_bound_tr(__x)))
726 {
return iterator(_M_t._M_lower_bound_tr(__x)); }
739 {
return _M_t.upper_bound(__x); }
743 {
return _M_t.upper_bound(__x); }
745 #if __cplusplus > 201103L
746 template<
typename _Kt>
749 -> decltype(iterator(_M_t._M_upper_bound_tr(__x)))
750 {
return iterator(_M_t._M_upper_bound_tr(__x)); }
752 template<
typename _Kt>
755 -> decltype(iterator(_M_t._M_upper_bound_tr(__x)))
756 {
return iterator(_M_t._M_upper_bound_tr(__x)); }
778 {
return _M_t.equal_range(__x); }
782 {
return _M_t.equal_range(__x); }
784 #if __cplusplus > 201103L
785 template<
typename _Kt>
788 -> decltype(pair<iterator, iterator>(_M_t._M_equal_range_tr(__x)))
789 {
return pair<iterator, iterator>(_M_t._M_equal_range_tr(__x)); }
791 template<
typename _Kt>
794 -> decltype(pair<iterator, iterator>(_M_t._M_equal_range_tr(__x)))
795 {
return pair<iterator, iterator>(_M_t._M_equal_range_tr(__x)); }
799 template<
typename _K1,
typename _C1,
typename _A1>
801 operator==(
const multiset<_K1, _C1, _A1>&,
802 const multiset<_K1, _C1, _A1>&);
804 template<
typename _K1,
typename _C1,
typename _A1>
806 operator< (
const multiset<_K1, _C1, _A1>&,
807 const multiset<_K1, _C1, _A1>&);
821 template<
typename _Key,
typename _Compare,
typename _Alloc>
825 {
return __x._M_t == __y._M_t; }
838 template<
typename _Key,
typename _Compare,
typename _Alloc>
842 {
return __x._M_t < __y._M_t; }
845 template<
typename _Key,
typename _Compare,
typename _Alloc>
849 {
return !(__x == __y); }
852 template<
typename _Key,
typename _Compare,
typename _Alloc>
856 {
return __y < __x; }
859 template<
typename _Key,
typename _Compare,
typename _Alloc>
863 {
return !(__y < __x); }
866 template<
typename _Key,
typename _Compare,
typename _Alloc>
870 {
return !(__x < __y); }
873 template<
typename _Key,
typename _Compare,
typename _Alloc>
877 _GLIBCXX_NOEXCEPT_IF(noexcept(__x.swap(__y)))
880 _GLIBCXX_END_NAMESPACE_CONTAINER