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;
54 #if __cplusplus >= 201103L
60 typedef _Key key_type;
61 typedef _Tp mapped_type;
63 typedef _Compare key_compare;
64 typedef _Allocator allocator_type;
65 typedef typename _Base::reference reference;
66 typedef typename _Base::const_reference const_reference;
73 typedef typename _Base::size_type size_type;
74 typedef typename _Base::difference_type difference_type;
75 typedef typename _Base::pointer pointer;
76 typedef typename _Base::const_pointer const_pointer;
84 explicit multimap(
const _Compare& __comp,
85 const _Allocator& __a = _Allocator())
86 :
_Base(__comp, __a) { }
88 template<
typename _InputIterator>
89 multimap(_InputIterator __first, _InputIterator __last,
90 const _Compare& __comp = _Compare(),
91 const _Allocator& __a = _Allocator())
103 #if __cplusplus >= 201103L
105 noexcept(is_nothrow_copy_constructible<_Compare>::value)
106 :
_Base(std::move(__x))
110 const _Compare& __c = _Compare(),
111 const allocator_type& __a = allocator_type())
112 :
_Base(__l, __c, __a) { }
119 :
_Base(__m, __a) { }
122 :
_Base(std::move(__m._M_base()), __a) { }
128 template<
typename _InputIterator>
129 multimap(_InputIterator __first, _InputIterator __last,
130 const allocator_type& __a)
143 this->_M_invalidate_all();
147 #if __cplusplus >= 201103L
150 noexcept(_Alloc_traits::_S_nothrow_move())
152 __glibcxx_check_self_move_assign(__x);
153 bool xfer_memory = _Alloc_traits::_S_propagate_on_move_assign()
154 || __x.get_allocator() == this->get_allocator();
155 _M_base() = std::move(__x._M_base());
159 this->_M_invalidate_all();
160 __x._M_invalidate_all();
168 this->_M_invalidate_all();
173 using _Base::get_allocator;
177 begin() _GLIBCXX_NOEXCEPT
178 {
return iterator(_Base::begin(),
this); }
181 begin()
const _GLIBCXX_NOEXCEPT
185 end() _GLIBCXX_NOEXCEPT
186 {
return iterator(_Base::end(),
this); }
189 end()
const _GLIBCXX_NOEXCEPT
193 rbegin() _GLIBCXX_NOEXCEPT
197 rbegin()
const _GLIBCXX_NOEXCEPT
201 rend() _GLIBCXX_NOEXCEPT
205 rend()
const _GLIBCXX_NOEXCEPT
208 #if __cplusplus >= 201103L
210 cbegin()
const noexcept
214 cend()
const noexcept
218 crbegin()
const noexcept
222 crend()
const noexcept
229 using _Base::max_size;
232 #if __cplusplus >= 201103L
233 template<
typename... _Args>
235 emplace(_Args&&... __args)
237 return iterator(_Base::emplace(std::forward<_Args>(__args)...),
this);
240 template<
typename... _Args>
246 std::forward<_Args>(__args)...),
253 {
return iterator(_Base::insert(__x),
this); }
255 #if __cplusplus >= 201103L
256 template<
typename _Pair,
typename =
typename
257 std::enable_if<std::is_constructible<
value_type,
258 _Pair&&>::value>::type>
261 {
return iterator(_Base::insert(std::forward<_Pair>(__x)),
this); }
264 #if __cplusplus >= 201103L
267 { _Base::insert(__list); }
271 #if __cplusplus >= 201103L
278 return iterator(_Base::insert(__position.
base(), __x),
this);
281 #if __cplusplus >= 201103L
282 template<
typename _Pair,
typename =
typename
283 std::enable_if<std::is_constructible<
value_type,
284 _Pair&&>::value>::type>
290 std::forward<_Pair>(__x)),
this);
294 template<
typename _InputIterator>
296 insert(_InputIterator __first, _InputIterator __last)
298 __glibcxx_check_valid_range(__first, __last);
303 #if __cplusplus >= 201103L
321 _Base::erase(__position.
base());
326 erase(
const key_type& __x)
329 _Base::equal_range(__x);
330 size_type __count = 0;
332 while (__victim != __victims.
second)
335 _Base::erase(__victim++);
341 #if __cplusplus >= 201103L
349 __victim != __last.
base(); ++__victim)
351 _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(),
352 _M_message(__gnu_debug::__msg_valid_range)
353 ._M_iterator(__first,
"first")
354 ._M_iterator(__last,
"last"));
367 __victim != __last.
base(); ++__victim)
369 _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(),
370 _M_message(__gnu_debug::__msg_valid_range)
371 ._M_iterator(__first,
"first")
372 ._M_iterator(__last,
"last"));
375 _Base::erase(__first.
base(), __last.
base());
381 #if __cplusplus >= 201103L
382 noexcept(_Alloc_traits::_S_nothrow_swap())
385 #if __cplusplus >= 201103L
386 if (!_Alloc_traits::_S_propagate_on_swap())
387 __glibcxx_check_equal_allocs(__x);
394 clear() _GLIBCXX_NOEXCEPT
396 this->_M_invalidate_all();
401 using _Base::key_comp;
402 using _Base::value_comp;
406 find(
const key_type& __x)
407 {
return iterator(_Base::find(__x),
this); }
410 find(
const key_type& __x)
const
416 lower_bound(
const key_type& __x)
417 {
return iterator(_Base::lower_bound(__x),
this); }
420 lower_bound(
const key_type& __x)
const
424 upper_bound(
const key_type& __x)
425 {
return iterator(_Base::upper_bound(__x),
this); }
428 upper_bound(
const key_type& __x)
const
432 equal_range(
const key_type& __x)
435 _Base::equal_range(__x);
441 equal_range(
const key_type& __x)
const
444 _Base::equal_range(__x);
450 _M_base() _GLIBCXX_NOEXCEPT {
return *
this; }
453 _M_base()
const _GLIBCXX_NOEXCEPT {
return *
this; }
464 template<
typename _Key,
typename _Tp,
465 typename _Compare,
typename _Allocator>
469 {
return __lhs._M_base() == __rhs._M_base(); }
471 template<
typename _Key,
typename _Tp,
472 typename _Compare,
typename _Allocator>
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 operator<=(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
489 const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
490 {
return __lhs._M_base() <= __rhs._M_base(); }
492 template<
typename _Key,
typename _Tp,
493 typename _Compare,
typename _Allocator>
495 operator>=(
const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
496 const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
497 {
return __lhs._M_base() >= __rhs._M_base(); }
499 template<
typename _Key,
typename _Tp,
500 typename _Compare,
typename _Allocator>
502 operator>(
const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
503 const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
504 {
return __lhs._M_base() > __rhs._M_base(); }
506 template<
typename _Key,
typename _Tp,
507 typename _Compare,
typename _Allocator>
509 swap(multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
510 multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
511 { __lhs.swap(__rhs); }
Struct holding two objects of arbitrary type.
_Siter_base< _Iterator >::iterator_type __base(_Iterator __it)
size_t count() const noexcept
Returns the number of bits which are set.
void _M_swap(_Safe_sequence_base &__x)
void _M_invalidate_if(_Predicate __pred)
Uniform interface to C++98 and C++0x allocators.
A standard container made up of (key,value) pairs, which can be retrieved based on a key...
_T2 second
first is a copy of the first object
#define __glibcxx_check_insert(_Position)
Class std::multimap with safety/checking/debug instrumentation.
_Iterator base() const noexcept
Return the underlying iterator.
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
Base class for constructing a safe sequence type that tracks iterators that reference it...
constexpr size_t size() const noexcept
Returns the total number of bits.
#define __glibcxx_check_erase(_Position)
#define __glibcxx_check_erase_range(_First, _Last)