29 #ifndef _GLIBCXX_DEBUG_MULTIMAP_H
30 #define _GLIBCXX_DEBUG_MULTIMAP_H 1
37 namespace std _GLIBCXX_VISIBILITY(default)
42 template<
typename _Key,
typename _Tp,
typename _Compare = std::less<_Key>,
43 typename _Allocator = std::allocator<std::pair<const _Key, _Tp> > >
46 multimap<_Key, _Tp, _Compare, _Allocator>, _Allocator,
47 __gnu_debug::_Safe_node_sequence>,
48 public _GLIBCXX_STD_C::multimap<_Key, _Tp, _Compare, _Allocator>
50 typedef _GLIBCXX_STD_C::multimap<
51 _Key, _Tp, _Compare, _Allocator>
_Base;
61 typedef _Key key_type;
62 typedef _Tp mapped_type;
64 typedef _Compare key_compare;
65 typedef _Allocator allocator_type;
66 typedef typename _Base::reference reference;
67 typedef typename _Base::const_reference const_reference;
74 typedef typename _Base::size_type size_type;
75 typedef typename _Base::difference_type difference_type;
76 typedef typename _Base::pointer pointer;
77 typedef typename _Base::const_pointer const_pointer;
83 #if __cplusplus < 201103L
96 const _Compare& __c = _Compare(),
97 const allocator_type& __a = allocator_type())
98 :
_Base(__l, __c, __a) { }
105 :
_Base(__m, __a) { }
108 :
_Safe(std::move(__m._M_safe()), __a),
109 _Base(std::move(__m._M_base()), __a) { }
112 :
_Base(__l, __a) { }
114 template<
typename _InputIterator>
115 multimap(_InputIterator __first, _InputIterator __last,
116 const allocator_type& __a)
124 explicit multimap(
const _Compare& __comp,
125 const _Allocator& __a = _Allocator())
126 :
_Base(__comp, __a) { }
128 template<
typename _InputIterator>
129 multimap(_InputIterator __first, _InputIterator __last,
130 const _Compare& __comp = _Compare(),
131 const _Allocator& __a = _Allocator())
140 #if __cplusplus < 201103L
144 this->_M_safe() = __x;
150 operator=(
const multimap&) =
default;
159 this->_M_invalidate_all();
164 using _Base::get_allocator;
168 begin() _GLIBCXX_NOEXCEPT
169 {
return iterator(_Base::begin(),
this); }
172 begin()
const _GLIBCXX_NOEXCEPT
176 end() _GLIBCXX_NOEXCEPT
177 {
return iterator(_Base::end(),
this); }
180 end()
const _GLIBCXX_NOEXCEPT
184 rbegin() _GLIBCXX_NOEXCEPT
188 rbegin()
const _GLIBCXX_NOEXCEPT
192 rend() _GLIBCXX_NOEXCEPT
196 rend()
const _GLIBCXX_NOEXCEPT
199 #if __cplusplus >= 201103L
201 cbegin()
const noexcept
205 cend()
const noexcept
209 crbegin()
const noexcept
213 crend()
const noexcept
220 using _Base::max_size;
223 #if __cplusplus >= 201103L
224 template<
typename... _Args>
226 emplace(_Args&&... __args)
228 return iterator(_Base::emplace(std::forward<_Args>(__args)...),
this);
231 template<
typename... _Args>
237 std::forward<_Args>(__args)...),
244 {
return iterator(_Base::insert(__x),
this); }
246 #if __cplusplus >= 201103L
247 template<
typename _Pair,
typename =
typename
248 std::enable_if<std::is_constructible<
value_type,
249 _Pair&&>::value>::type>
252 {
return iterator(_Base::insert(std::forward<_Pair>(__x)),
this); }
255 #if __cplusplus >= 201103L
258 { _Base::insert(__list); }
262 #if __cplusplus >= 201103L
269 return iterator(_Base::insert(__position.
base(), __x),
this);
272 #if __cplusplus >= 201103L
273 template<
typename _Pair,
typename =
typename
274 std::enable_if<std::is_constructible<
value_type,
275 _Pair&&>::value>::type>
281 std::forward<_Pair>(__x)),
this);
285 template<
typename _InputIterator>
287 insert(_InputIterator __first, _InputIterator __last)
289 __glibcxx_check_valid_range(__first, __last);
294 #if __cplusplus >= 201103L
312 _Base::erase(__position.
base());
317 erase(
const key_type& __x)
320 _Base::equal_range(__x);
321 size_type __count = 0;
323 while (__victim != __victims.
second)
326 _Base::erase(__victim++);
332 #if __cplusplus >= 201103L
340 __victim != __last.
base(); ++__victim)
342 _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(),
343 _M_message(__gnu_debug::__msg_valid_range)
344 ._M_iterator(__first,
"first")
345 ._M_iterator(__last,
"last"));
358 __victim != __last.
base(); ++__victim)
360 _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(),
361 _M_message(__gnu_debug::__msg_valid_range)
362 ._M_iterator(__first,
"first")
363 ._M_iterator(__last,
"last"));
366 _Base::erase(__first.
base(), __last.
base());
372 #if __cplusplus >= 201103L
373 noexcept( noexcept(declval<_Base>().swap(__x)) )
381 clear() _GLIBCXX_NOEXCEPT
383 this->_M_invalidate_all();
388 using _Base::key_comp;
389 using _Base::value_comp;
393 find(
const key_type& __x)
394 {
return iterator(_Base::find(__x),
this); }
397 find(
const key_type& __x)
const
403 lower_bound(
const key_type& __x)
404 {
return iterator(_Base::lower_bound(__x),
this); }
407 lower_bound(
const key_type& __x)
const
411 upper_bound(
const key_type& __x)
412 {
return iterator(_Base::upper_bound(__x),
this); }
415 upper_bound(
const key_type& __x)
const
419 equal_range(
const key_type& __x)
422 _Base::equal_range(__x);
428 equal_range(
const key_type& __x)
const
431 _Base::equal_range(__x);
437 _M_base() _GLIBCXX_NOEXCEPT {
return *
this; }
440 _M_base()
const _GLIBCXX_NOEXCEPT {
return *
this; }
443 template<
typename _Key,
typename _Tp,
444 typename _Compare,
typename _Allocator>
448 {
return __lhs._M_base() == __rhs._M_base(); }
450 template<
typename _Key,
typename _Tp,
451 typename _Compare,
typename _Allocator>
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 operator<=(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
468 const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
469 {
return __lhs._M_base() <= __rhs._M_base(); }
471 template<
typename _Key,
typename _Tp,
472 typename _Compare,
typename _Allocator>
474 operator>=(
const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
475 const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
476 {
return __lhs._M_base() >= __rhs._M_base(); }
478 template<
typename _Key,
typename _Tp,
479 typename _Compare,
typename _Allocator>
481 operator>(
const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
482 const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
483 {
return __lhs._M_base() > __rhs._M_base(); }
485 template<
typename _Key,
typename _Tp,
486 typename _Compare,
typename _Allocator>
488 swap(multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
489 multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
490 { __lhs.swap(__rhs); }
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.
_T1 first
second_type is the second bound type
Struct holding two objects of arbitrary type.
#define __glibcxx_check_erase(_Position)
_Iterator & base() noexcept
Return the underlying iterator.
void _M_invalidate_if(_Predicate __pred)
A standard container made up of (key,value) pairs, which can be retrieved based on a key...
Class std::multimap with safety/checking/debug instrumentation.
#define __glibcxx_check_erase_range(_First, _Last)
Safe class dealing with some allocator dependent operations.
_Siter_base< _Iterator >::iterator_type __base(_Iterator __it)
_T2 second
first is a copy of the first object
Like _Safe_sequence but with a special _M_invalidate_all implementation not invalidating past-the-end...
#define __glibcxx_check_insert(_Position)