30 #ifndef _GLIBCXX_DEBUG_MULTISET_H
31 #define _GLIBCXX_DEBUG_MULTISET_H 1
37 namespace std _GLIBCXX_VISIBILITY(default)
42 template<
typename _Key,
typename _Compare = std::less<_Key>,
43 typename _Allocator = std::allocator<_Key> >
45 :
public _GLIBCXX_STD_C::multiset<_Key, _Compare, _Allocator>,
48 typedef _GLIBCXX_STD_C::multiset<_Key, _Compare, _Allocator>
_Base;
55 typedef _Key key_type;
56 typedef _Key value_type;
57 typedef _Compare key_compare;
58 typedef _Compare value_compare;
59 typedef _Allocator allocator_type;
60 typedef typename _Base::reference reference;
61 typedef typename _Base::const_reference const_reference;
68 typedef typename _Base::size_type size_type;
69 typedef typename _Base::difference_type difference_type;
70 typedef typename _Base::pointer pointer;
71 typedef typename _Base::const_pointer const_pointer;
76 explicit multiset(
const _Compare& __comp = _Compare(),
77 const _Allocator& __a = _Allocator())
78 : _Base(__comp, __a) { }
80 template<
typename _InputIterator>
81 multiset(_InputIterator __first, _InputIterator __last,
82 const _Compare& __comp = _Compare(),
83 const _Allocator& __a = _Allocator())
95 #ifdef __GXX_EXPERIMENTAL_CXX0X__
97 noexcept(is_nothrow_copy_constructible<_Compare>::value)
101 multiset(initializer_list<value_type> __l,
102 const _Compare& __comp = _Compare(),
103 const allocator_type& __a = allocator_type())
104 : _Base(__l, __comp, __a) { }
112 *
static_cast<_Base*
>(
this) = __x;
113 this->_M_invalidate_all();
117 #ifdef __GXX_EXPERIMENTAL_CXX0X__
129 operator=(initializer_list<value_type> __l)
137 using _Base::get_allocator;
141 begin() _GLIBCXX_NOEXCEPT
142 {
return iterator(_Base::begin(),
this); }
145 begin()
const _GLIBCXX_NOEXCEPT
146 {
return const_iterator(_Base::begin(),
this); }
149 end() _GLIBCXX_NOEXCEPT
150 {
return iterator(_Base::end(),
this); }
153 end()
const _GLIBCXX_NOEXCEPT
154 {
return const_iterator(_Base::end(),
this); }
157 rbegin() _GLIBCXX_NOEXCEPT
158 {
return reverse_iterator(end()); }
160 const_reverse_iterator
161 rbegin()
const _GLIBCXX_NOEXCEPT
162 {
return const_reverse_iterator(end()); }
165 rend() _GLIBCXX_NOEXCEPT
166 {
return reverse_iterator(begin()); }
168 const_reverse_iterator
169 rend()
const _GLIBCXX_NOEXCEPT
170 {
return const_reverse_iterator(begin()); }
172 #ifdef __GXX_EXPERIMENTAL_CXX0X__
174 cbegin()
const noexcept
175 {
return const_iterator(_Base::begin(),
this); }
178 cend()
const noexcept
179 {
return const_iterator(_Base::end(),
this); }
181 const_reverse_iterator
182 crbegin()
const noexcept
183 {
return const_reverse_iterator(end()); }
185 const_reverse_iterator
186 crend()
const noexcept
187 {
return const_reverse_iterator(begin()); }
193 using _Base::max_size;
197 insert(
const value_type& __x)
198 {
return iterator(_Base::insert(__x),
this); }
200 #ifdef __GXX_EXPERIMENTAL_CXX0X__
202 insert(value_type&& __x)
203 {
return iterator(_Base::insert(
std::move(__x)),
this); }
207 insert(const_iterator __position,
const value_type& __x)
210 return iterator(_Base::insert(__position.
base(), __x),
this);
213 #ifdef __GXX_EXPERIMENTAL_CXX0X__
215 insert(const_iterator __position, value_type&& __x)
218 return iterator(_Base::insert(__position.
base(),
std::move(__x)),
223 template<
typename _InputIterator>
225 insert(_InputIterator __first, _InputIterator __last)
227 __glibcxx_check_valid_range(__first, __last);
232 #ifdef __GXX_EXPERIMENTAL_CXX0X__
234 insert(initializer_list<value_type> __l)
235 { _Base::insert(__l); }
238 #ifdef __GXX_EXPERIMENTAL_CXX0X__
240 erase(const_iterator __position)
244 return iterator(_Base::erase(__position.
base()),
this);
248 erase(iterator __position)
252 _Base::erase(__position.
base());
257 erase(
const key_type& __x)
260 _Base::equal_range(__x);
261 size_type __count = 0;
262 _Base_iterator __victim = __victims.
first;
263 while (__victim != __victims.
second)
266 _Base::erase(__victim++);
272 #ifdef __GXX_EXPERIMENTAL_CXX0X__
274 erase(const_iterator __first, const_iterator __last)
279 for (_Base_const_iterator __victim = __first.
base();
280 __victim != __last.
base(); ++__victim)
282 _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(),
283 _M_message(__gnu_debug::__msg_valid_range)
284 ._M_iterator(__first,
"first")
285 ._M_iterator(__last,
"last"));
288 return iterator(_Base::erase(__first.
base(), __last.
base()),
this);
292 erase(iterator __first, iterator __last)
297 for (_Base_iterator __victim = __first.
base();
298 __victim != __last.
base(); ++__victim)
300 _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(),
301 _M_message(__gnu_debug::__msg_valid_range)
302 ._M_iterator(__first,
"first")
303 ._M_iterator(__last,
"last"));
306 _Base::erase(__first.
base(), __last.
base());
318 clear() _GLIBCXX_NOEXCEPT
320 this->_M_invalidate_all();
325 using _Base::key_comp;
326 using _Base::value_comp;
330 find(
const key_type& __x)
331 {
return iterator(_Base::find(__x),
this); }
336 find(
const key_type& __x)
const
337 {
return const_iterator(_Base::find(__x),
this); }
342 lower_bound(
const key_type& __x)
343 {
return iterator(_Base::lower_bound(__x),
this); }
348 lower_bound(
const key_type& __x)
const
349 {
return const_iterator(_Base::lower_bound(__x),
this); }
352 upper_bound(
const key_type& __x)
353 {
return iterator(_Base::upper_bound(__x),
this); }
358 upper_bound(
const key_type& __x)
const
359 {
return const_iterator(_Base::upper_bound(__x),
this); }
362 equal_range(
const key_type& __x)
365 _Base::equal_range(__x);
367 iterator(__res.
second,
this));
373 equal_range(
const key_type& __x)
const
376 _Base::equal_range(__x);
378 const_iterator(__res.
second,
this));
382 _M_base() _GLIBCXX_NOEXCEPT {
return *
this; }
385 _M_base()
const _GLIBCXX_NOEXCEPT {
return *
this; }
396 template<
typename _Key,
typename _Compare,
typename _Allocator>
400 {
return __lhs._M_base() == __rhs._M_base(); }
402 template<
typename _Key,
typename _Compare,
typename _Allocator>
406 {
return __lhs._M_base() != __rhs._M_base(); }
408 template<
typename _Key,
typename _Compare,
typename _Allocator>
410 operator<(const multiset<_Key, _Compare, _Allocator>& __lhs,
411 const multiset<_Key, _Compare, _Allocator>& __rhs)
412 {
return __lhs._M_base() < __rhs._M_base(); }
414 template<
typename _Key,
typename _Compare,
typename _Allocator>
416 operator<=(const multiset<_Key, _Compare, _Allocator>& __lhs,
417 const multiset<_Key, _Compare, _Allocator>& __rhs)
418 {
return __lhs._M_base() <= __rhs._M_base(); }
420 template<
typename _Key,
typename _Compare,
typename _Allocator>
422 operator>=(
const multiset<_Key, _Compare, _Allocator>& __lhs,
423 const multiset<_Key, _Compare, _Allocator>& __rhs)
424 {
return __lhs._M_base() >= __rhs._M_base(); }
426 template<
typename _Key,
typename _Compare,
typename _Allocator>
428 operator>(
const multiset<_Key, _Compare, _Allocator>& __lhs,
429 const multiset<_Key, _Compare, _Allocator>& __rhs)
430 {
return __lhs._M_base() > __rhs._M_base(); }
432 template<
typename _Key,
typename _Compare,
typename _Allocator>
434 swap(multiset<_Key, _Compare, _Allocator>& __x,
435 multiset<_Key, _Compare, _Allocator>& __y)
436 {
return __x.swap(__y); }
A standard container made up of elements, which can be retrieved in logarithmic time.
#define __glibcxx_check_erase_range(_First, _Last)
Class std::multiset with safety/checking/debug instrumentation.
_T2 second
first is a copy of the first object
#define __glibcxx_check_erase(_Position)
bool operator>=(const basic_string< _CharT, _Traits, _Alloc > &__lhs, const basic_string< _CharT, _Traits, _Alloc > &__rhs)
Test if string doesn't precede string.
Base class for constructing a safe sequence type that tracks iterators that reference it...
void _M_invalidate_if(_Predicate __pred)
#define __glibcxx_check_insert(_Position)
void _M_swap(_Safe_sequence_base &__x)
bool operator>(const basic_string< _CharT, _Traits, _Alloc > &__lhs, const basic_string< _CharT, _Traits, _Alloc > &__rhs)
Test if string follows string.
_T1 first
second_type is the second bound type
ISO C++ entities toplevel namespace is std.
constexpr pair< typename __decay_and_strip< _T1 >::__type, typename __decay_and_strip< _T2 >::__type > make_pair(_T1 &&__x, _T2 &&__y)
A convenience wrapper for creating a pair from two objects.
_Iterator base() const
Return the underlying iterator.
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
_Siter_base< _Iterator >::iterator_type __base(_Iterator __it)
void swap(_Tp &, _Tp &) noexcept(__and_< is_nothrow_move_constructible< _Tp >, is_nothrow_move_assignable< _Tp >>::value)
Swaps two values.
Struct holding two objects of arbitrary type.