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
97 noexcept(is_nothrow_copy_constructible<_Compare>::value)
101 multimap(initializer_list<value_type> __l,
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);
130 operator=(initializer_list<value_type> __l)
138 using _Base::get_allocator;
142 begin() _GLIBCXX_NOEXCEPT
143 {
return iterator(_Base::begin(),
this); }
146 begin()
const _GLIBCXX_NOEXCEPT
147 {
return const_iterator(_Base::begin(),
this); }
150 end() _GLIBCXX_NOEXCEPT
151 {
return iterator(_Base::end(),
this); }
154 end()
const _GLIBCXX_NOEXCEPT
155 {
return const_iterator(_Base::end(),
this); }
158 rbegin() _GLIBCXX_NOEXCEPT
159 {
return reverse_iterator(end()); }
161 const_reverse_iterator
162 rbegin()
const _GLIBCXX_NOEXCEPT
163 {
return const_reverse_iterator(end()); }
166 rend() _GLIBCXX_NOEXCEPT
167 {
return reverse_iterator(begin()); }
169 const_reverse_iterator
170 rend()
const _GLIBCXX_NOEXCEPT
171 {
return const_reverse_iterator(begin()); }
173 #if __cplusplus >= 201103L
175 cbegin()
const noexcept
176 {
return const_iterator(_Base::begin(),
this); }
179 cend()
const noexcept
180 {
return const_iterator(_Base::end(),
this); }
182 const_reverse_iterator
183 crbegin()
const noexcept
184 {
return const_reverse_iterator(end()); }
186 const_reverse_iterator
187 crend()
const noexcept
188 {
return const_reverse_iterator(begin()); }
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>
207 emplace_hint(const_iterator __pos, _Args&&... __args)
210 return iterator(_Base::emplace_hint(__pos.
base(),
211 std::forward<_Args>(__args)...),
217 insert(
const value_type& __x)
218 {
return iterator(_Base::insert(__x),
this); }
220 #if __cplusplus >= 201103L
221 template<
typename _Pair,
typename =
typename
222 std::enable_if<std::is_constructible<value_type,
223 _Pair&&>::value>::type>
226 {
return iterator(_Base::insert(std::forward<_Pair>(__x)),
this); }
229 #if __cplusplus >= 201103L
231 insert(std::initializer_list<value_type> __list)
232 { _Base::insert(__list); }
236 #if __cplusplus >= 201103L
237 insert(const_iterator __position,
const value_type& __x)
239 insert(iterator __position,
const value_type& __x)
243 return iterator(_Base::insert(__position.
base(), __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>
251 insert(const_iterator __position, _Pair&& __x)
254 return iterator(_Base::insert(__position.
base(),
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
270 erase(const_iterator __position)
274 return iterator(_Base::erase(__position.
base()),
this);
278 erase(iterator __position)
279 {
return erase(const_iterator(__position)); }
282 erase(iterator __position)
286 _Base::erase(__position.
base());
291 erase(
const key_type& __x)
294 _Base::equal_range(__x);
295 size_type __count = 0;
296 _Base_iterator __victim = __victims.
first;
297 while (__victim != __victims.
second)
300 _Base::erase(__victim++);
306 #if __cplusplus >= 201103L
308 erase(const_iterator __first, const_iterator __last)
313 for (_Base_const_iterator __victim = __first.
base();
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"));
322 return iterator(_Base::erase(__first.
base(), __last.
base()),
this);
326 erase(iterator __first, iterator __last)
331 for (_Base_iterator __victim = __first.
base();
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
369 {
return const_iterator(_Base::find(__x),
this); }
374 lower_bound(
const key_type& __x)
375 {
return iterator(_Base::lower_bound(__x),
this); }
378 lower_bound(
const key_type& __x)
const
379 {
return const_iterator(_Base::lower_bound(__x),
this); }
382 upper_bound(
const key_type& __x)
383 {
return iterator(_Base::upper_bound(__x),
this); }
386 upper_bound(
const key_type& __x)
const
387 {
return const_iterator(_Base::upper_bound(__x),
this); }
390 equal_range(
const key_type& __x)
393 _Base::equal_range(__x);
395 iterator(__res.
second,
this));
399 equal_range(
const key_type& __x)
const
402 _Base::equal_range(__x);
404 const_iterator(__res.
second,
this));
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); }
_Siter_base< _Iterator >::iterator_type __base(_Iterator __it)
#define __glibcxx_check_insert(_Position)
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
Base class for constructing a safe sequence type that tracks iterators that reference it...
bool operator>=(const basic_string< _CharT, _Traits, _Alloc > &__lhs, const basic_string< _CharT, _Traits, _Alloc > &__rhs)
Test if string doesn't precede string.
void _M_invalidate_if(_Predicate __pred)
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.
Class std::multimap with safety/checking/debug instrumentation.
ISO C++ entities toplevel namespace is std.
void _M_swap(_Safe_sequence_base &__x)
_T1 first
second_type is the second bound type
#define __glibcxx_check_erase(_Position)
A standard container made up of (key,value) pairs, which can be retrieved based on a key...
void swap(_Tp &, _Tp &) noexcept(__and_< is_nothrow_move_constructible< _Tp >, is_nothrow_move_assignable< _Tp >>::value)
Swaps two values.
_Iterator base() const
Return the underlying iterator.
#define __glibcxx_check_erase_range(_First, _Last)
Struct holding two objects of arbitrary type.
_T2 second
first is a copy of the first object
bool operator>(const basic_string< _CharT, _Traits, _Alloc > &__lhs, const basic_string< _CharT, _Traits, _Alloc > &__rhs)
Test if string follows string.