30 #ifndef _GLIBCXX_DEBUG_MULTISET_H
31 #define _GLIBCXX_DEBUG_MULTISET_H 1
41 template<
typename _Key,
typename _Compare = std::less<_Key>,
42 typename _Allocator = std::allocator<_Key> >
44 :
public _GLIBCXX_STD_D::multiset<_Key, _Compare, _Allocator>,
47 typedef _GLIBCXX_STD_D::multiset<_Key, _Compare, _Allocator> _Base;
52 typedef _Key key_type;
53 typedef _Key value_type;
54 typedef _Compare key_compare;
55 typedef _Compare value_compare;
56 typedef _Allocator allocator_type;
57 typedef typename _Base::reference reference;
58 typedef typename _Base::const_reference const_reference;
63 multiset> const_iterator;
65 typedef typename _Base::size_type size_type;
66 typedef typename _Base::difference_type difference_type;
67 typedef typename _Base::pointer pointer;
68 typedef typename _Base::const_pointer const_pointer;
73 explicit multiset(
const _Compare& __comp = _Compare(),
74 const _Allocator& __a = _Allocator())
75 : _Base(__comp, __a) { }
77 template<
typename _InputIterator>
78 multiset(_InputIterator __first, _InputIterator __last,
79 const _Compare& __comp = _Compare(),
80 const _Allocator& __a = _Allocator())
81 : _Base(__gnu_debug::__check_valid_range(__first, __last), __last,
84 multiset(
const multiset& __x)
85 : _Base(__x), _Safe_base() { }
87 multiset(
const _Base& __x)
88 : _Base(__x), _Safe_base() { }
90 #ifdef __GXX_EXPERIMENTAL_CXX0X__
91 multiset(multiset&& __x)
92 : _Base(std::forward<multiset>(__x)), _Safe_base()
95 multiset(initializer_list<value_type> __l,
96 const _Compare& __comp = _Compare(),
97 const allocator_type& __a = allocator_type())
98 : _Base(__l, __comp, __a), _Safe_base() { }
104 operator=(
const multiset& __x)
106 *
static_cast<_Base*
>(
this) = __x;
111 #ifdef __GXX_EXPERIMENTAL_CXX0X__
113 operator=(multiset&& __x)
122 operator=(initializer_list<value_type> __l)
130 using _Base::get_allocator;
135 {
return iterator(_Base::begin(),
this); }
139 {
return const_iterator(_Base::begin(),
this); }
143 {
return iterator(_Base::end(),
this); }
147 {
return const_iterator(_Base::end(),
this); }
151 {
return reverse_iterator(end()); }
153 const_reverse_iterator
155 {
return const_reverse_iterator(end()); }
159 {
return reverse_iterator(begin()); }
161 const_reverse_iterator
163 {
return const_reverse_iterator(begin()); }
165 #ifdef __GXX_EXPERIMENTAL_CXX0X__
168 {
return const_iterator(_Base::begin(),
this); }
172 {
return const_iterator(_Base::end(),
this); }
174 const_reverse_iterator
176 {
return const_reverse_iterator(end()); }
178 const_reverse_iterator
180 {
return const_reverse_iterator(begin()); }
186 using _Base::max_size;
190 insert(
const value_type& __x)
191 {
return iterator(_Base::insert(__x),
this); }
194 insert(iterator __position,
const value_type& __x)
197 return iterator(_Base::insert(__position.base(), __x),
this);
200 template<
typename _InputIterator>
202 insert(_InputIterator __first, _InputIterator __last)
204 __glibcxx_check_valid_range(__first, __last);
205 _Base::insert(__first, __last);
208 #ifdef __GXX_EXPERIMENTAL_CXX0X__
210 insert(initializer_list<value_type> __l)
211 { _Base::insert(__l); }
215 erase(iterator __position)
218 __position._M_invalidate();
219 _Base::erase(__position.base());
223 erase(
const key_type& __x)
226 size_type __count = 0;
229 iterator __victim = __victims.
first++;
231 _Base::erase(__victim.base());
238 erase(iterator __first, iterator __last)
243 while (__first != __last)
244 this->erase(__first++);
248 #ifdef __GXX_EXPERIMENTAL_CXX0X__
260 { this->erase(begin(), end()); }
263 using _Base::key_comp;
264 using _Base::value_comp;
268 find(
const key_type& __x)
269 {
return iterator(_Base::find(__x),
this); }
274 find(
const key_type& __x)
const
275 {
return const_iterator(_Base::find(__x),
this); }
280 lower_bound(
const key_type& __x)
281 {
return iterator(_Base::lower_bound(__x),
this); }
286 lower_bound(
const key_type& __x)
const
287 {
return const_iterator(_Base::lower_bound(__x),
this); }
290 upper_bound(
const key_type& __x)
291 {
return iterator(_Base::upper_bound(__x),
this); }
296 upper_bound(
const key_type& __x)
const
297 {
return const_iterator(_Base::upper_bound(__x),
this); }
300 equal_range(
const key_type& __x)
302 typedef typename _Base::iterator _Base_iterator;
304 _Base::equal_range(__x);
305 return std::make_pair(iterator(__res.
first,
this),
306 iterator(__res.
second,
this));
312 equal_range(
const key_type& __x)
const
314 typedef typename _Base::const_iterator _Base_iterator;
316 _Base::equal_range(__x);
317 return std::make_pair(const_iterator(__res.
first,
this),
318 const_iterator(__res.
second,
this));
322 _M_base() {
return *
this; }
325 _M_base()
const {
return *
this; }
331 typedef typename _Base::const_iterator _Base_const_iterator;
337 template<
typename _Key,
typename _Compare,
typename _Allocator>
339 operator==(
const multiset<_Key, _Compare, _Allocator>& __lhs,
340 const multiset<_Key, _Compare, _Allocator>& __rhs)
341 {
return __lhs._M_base() == __rhs._M_base(); }
343 template<
typename _Key,
typename _Compare,
typename _Allocator>
345 operator!=(
const multiset<_Key, _Compare, _Allocator>& __lhs,
346 const multiset<_Key, _Compare, _Allocator>& __rhs)
347 {
return __lhs._M_base() != __rhs._M_base(); }
349 template<
typename _Key,
typename _Compare,
typename _Allocator>
351 operator<(const multiset<_Key, _Compare, _Allocator>& __lhs,
352 const multiset<_Key, _Compare, _Allocator>& __rhs)
353 {
return __lhs._M_base() < __rhs._M_base(); }
355 template<
typename _Key,
typename _Compare,
typename _Allocator>
357 operator<=(const multiset<_Key, _Compare, _Allocator>& __lhs,
358 const multiset<_Key, _Compare, _Allocator>& __rhs)
359 {
return __lhs._M_base() <= __rhs._M_base(); }
361 template<
typename _Key,
typename _Compare,
typename _Allocator>
363 operator>=(
const multiset<_Key, _Compare, _Allocator>& __lhs,
364 const multiset<_Key, _Compare, _Allocator>& __rhs)
365 {
return __lhs._M_base() >= __rhs._M_base(); }
367 template<
typename _Key,
typename _Compare,
typename _Allocator>
369 operator>(
const multiset<_Key, _Compare, _Allocator>& __lhs,
370 const multiset<_Key, _Compare, _Allocator>& __rhs)
371 {
return __lhs._M_base() > __rhs._M_base(); }
373 template<
typename _Key,
typename _Compare,
typename _Allocator>
375 swap(multiset<_Key, _Compare, _Allocator>& __x,
376 multiset<_Key, _Compare, _Allocator>& __y)
377 {
return __x.swap(__y); }
379 #ifdef __GXX_EXPERIMENTAL_CXX0X__
380 template<
typename _Key,
typename _Compare,
typename _Allocator>
382 swap(multiset<_Key, _Compare, _Allocator>&& __x,
383 multiset<_Key, _Compare, _Allocator>& __y)
384 {
return __x.swap(__y); }
386 template<
typename _Key,
typename _Compare,
typename _Allocator>
388 swap(multiset<_Key, _Compare, _Allocator>& __x,
389 multiset<_Key, _Compare, _Allocator>&& __y)
390 {
return __x.swap(__y); }