29 #ifndef _GLIBCXX_DEBUG_MULTIMAP_H
30 #define _GLIBCXX_DEBUG_MULTIMAP_H 1
36 namespace std _GLIBCXX_VISIBILITY(default)
41 template<
typename _Key,
typename _Tp,
typename _Compare = std::less<_Key>,
42 typename _Allocator = std::allocator<std::pair<const _Key, _Tp> > >
44 :
public _GLIBCXX_STD_C::multimap<_Key, _Tp, _Compare, _Allocator>,
46 _Compare, _Allocator> >
48 typedef _GLIBCXX_STD_C::multimap<_Key, _Tp, _Compare, _Allocator>
_Base;
55 typedef _Key key_type;
56 typedef _Tp mapped_type;
58 typedef _Compare key_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 multimap(
const _Compare& __comp = _Compare(),
77 const _Allocator& __a = _Allocator())
78 :
_Base(__comp, __a) { }
80 template<
typename _InputIterator>
81 multimap(_InputIterator __first, _InputIterator __last,
82 const _Compare& __comp = _Compare(),
83 const _Allocator& __a = _Allocator())
95 #if __cplusplus >= 201103L
98 :
_Base(std::move(__x))
102 const _Compare& __c = _Compare(),
103 const allocator_type& __a = allocator_type())
104 :
_Base(__l, __c, __a) { }
112 *
static_cast<_Base*
>(
this) = __x;
113 this->_M_invalidate_all();
117 #if __cplusplus >= 201103L
123 __glibcxx_check_self_move_assign(__x);
138 using _Base::get_allocator;
142 begin() _GLIBCXX_NOEXCEPT
143 {
return iterator(_Base::begin(),
this); }
146 begin()
const _GLIBCXX_NOEXCEPT
150 end() _GLIBCXX_NOEXCEPT
151 {
return iterator(_Base::end(),
this); }
154 end()
const _GLIBCXX_NOEXCEPT
158 rbegin() _GLIBCXX_NOEXCEPT
162 rbegin()
const _GLIBCXX_NOEXCEPT
166 rend() _GLIBCXX_NOEXCEPT
170 rend()
const _GLIBCXX_NOEXCEPT
173 #if __cplusplus >= 201103L
175 cbegin()
const noexcept
179 cend()
const noexcept
183 crbegin()
const noexcept
187 crend()
const noexcept
194 using _Base::max_size;
197 #if __cplusplus >= 201103L
198 template<
typename... _Args>
200 emplace(_Args&&... __args)
202 return iterator(_Base::emplace(std::forward<_Args>(__args)...),
this);
205 template<
typename... _Args>
211 std::forward<_Args>(__args)...),
218 {
return iterator(_Base::insert(__x),
this); }
220 #if __cplusplus >= 201103L
221 template<
typename _Pair,
typename =
typename
223 _Pair&&>::value>::type>
226 {
return iterator(_Base::insert(std::forward<_Pair>(__x)),
this); }
229 #if __cplusplus >= 201103L
232 { _Base::insert(__list); }
236 #if __cplusplus >= 201103L
243 return iterator(_Base::insert(__position.
base(), __x),
this);
246 #if __cplusplus >= 201103L
247 template<
typename _Pair,
typename =
typename
249 _Pair&&>::value>::type>
255 std::forward<_Pair>(__x)),
this);
259 template<
typename _InputIterator>
261 insert(_InputIterator __first, _InputIterator __last)
263 __glibcxx_check_valid_range(__first, __last);
268 #if __cplusplus >= 201103L
286 _Base::erase(__position.
base());
291 erase(
const key_type& __x)
294 _Base::equal_range(__x);
295 size_type __count = 0;
297 while (__victim != __victims.
second)
300 _Base::erase(__victim++);
306 #if __cplusplus >= 201103L
314 __victim != __last.
base(); ++__victim)
316 _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(),
317 _M_message(__gnu_debug::__msg_valid_range)
318 ._M_iterator(__first,
"first")
319 ._M_iterator(__last,
"last"));
332 __victim != __last.
base(); ++__victim)
334 _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(),
335 _M_message(__gnu_debug::__msg_valid_range)
336 ._M_iterator(__first,
"first")
337 ._M_iterator(__last,
"last"));
340 _Base::erase(__first.
base(), __last.
base());
352 clear() _GLIBCXX_NOEXCEPT
354 this->_M_invalidate_all();
359 using _Base::key_comp;
360 using _Base::value_comp;
364 find(
const key_type& __x)
365 {
return iterator(_Base::find(__x),
this); }
368 find(
const key_type& __x)
const
374 lower_bound(
const key_type& __x)
375 {
return iterator(_Base::lower_bound(__x),
this); }
378 lower_bound(
const key_type& __x)
const
382 upper_bound(
const key_type& __x)
383 {
return iterator(_Base::upper_bound(__x),
this); }
386 upper_bound(
const key_type& __x)
const
390 equal_range(
const key_type& __x)
393 _Base::equal_range(__x);
399 equal_range(
const key_type& __x)
const
402 _Base::equal_range(__x);
408 _M_base() _GLIBCXX_NOEXCEPT {
return *
this; }
411 _M_base()
const _GLIBCXX_NOEXCEPT {
return *
this; }
422 template<
typename _Key,
typename _Tp,
423 typename _Compare,
typename _Allocator>
427 {
return __lhs._M_base() == __rhs._M_base(); }
429 template<
typename _Key,
typename _Tp,
430 typename _Compare,
typename _Allocator>
434 {
return __lhs._M_base() != __rhs._M_base(); }
436 template<
typename _Key,
typename _Tp,
437 typename _Compare,
typename _Allocator>
439 operator<(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
440 const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
441 {
return __lhs._M_base() < __rhs._M_base(); }
443 template<
typename _Key,
typename _Tp,
444 typename _Compare,
typename _Allocator>
446 operator<=(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
447 const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
448 {
return __lhs._M_base() <= __rhs._M_base(); }
450 template<
typename _Key,
typename _Tp,
451 typename _Compare,
typename _Allocator>
453 operator>=(
const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
454 const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
455 {
return __lhs._M_base() >= __rhs._M_base(); }
457 template<
typename _Key,
typename _Tp,
458 typename _Compare,
typename _Allocator>
460 operator>(
const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
461 const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
462 {
return __lhs._M_base() > __rhs._M_base(); }
464 template<
typename _Key,
typename _Tp,
465 typename _Compare,
typename _Allocator>
467 swap(multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
468 multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
469 { __lhs.swap(__rhs); }