30 #ifndef _GLIBCXX_DEBUG_MULTIMAP_H
31 #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> > >
45 :
public _GLIBCXX_STD_C::multimap<_Key, _Tp, _Compare, _Allocator>,
47 _Compare, _Allocator> >
49 typedef _GLIBCXX_STD_C::multimap<_Key, _Tp, _Compare, _Allocator>
_Base;
56 typedef _Key key_type;
57 typedef _Tp mapped_type;
59 typedef _Compare key_compare;
60 typedef _Allocator allocator_type;
61 typedef typename _Base::reference reference;
62 typedef typename _Base::const_reference const_reference;
69 typedef typename _Base::size_type size_type;
70 typedef typename _Base::difference_type difference_type;
71 typedef typename _Base::pointer pointer;
72 typedef typename _Base::const_pointer const_pointer;
77 explicit multimap(
const _Compare& __comp = _Compare(),
78 const _Allocator& __a = _Allocator())
79 :
_Base(__comp, __a) { }
81 template<
typename _InputIterator>
82 multimap(_InputIterator __first, _InputIterator __last,
83 const _Compare& __comp = _Compare(),
84 const _Allocator& __a = _Allocator())
96 #ifdef __GXX_EXPERIMENTAL_CXX0X__
99 :
_Base(std::move(__x))
103 const _Compare& __c = _Compare(),
104 const allocator_type& __a = allocator_type())
105 :
_Base(__l, __c, __a) { }
113 *
static_cast<_Base*
>(
this) = __x;
114 this->_M_invalidate_all();
118 #ifdef __GXX_EXPERIMENTAL_CXX0X__
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 #ifdef __GXX_EXPERIMENTAL_CXX0X__
175 cbegin()
const noexcept
179 cend()
const noexcept
183 crbegin()
const noexcept
187 crend()
const noexcept
194 using _Base::max_size;
199 {
return iterator(_Base::insert(__x),
this); }
201 #ifdef __GXX_EXPERIMENTAL_CXX0X__
202 template<
typename _Pair,
typename =
typename
204 _Pair&&>::value>::type>
207 {
return iterator(_Base::insert(std::forward<_Pair>(__x)),
this); }
210 #ifdef __GXX_EXPERIMENTAL_CXX0X__
213 { _Base::insert(__list); }
217 #ifdef __GXX_EXPERIMENTAL_CXX0X__
224 return iterator(_Base::insert(__position.
base(), __x),
this);
227 #ifdef __GXX_EXPERIMENTAL_CXX0X__
228 template<
typename _Pair,
typename =
typename
230 _Pair&&>::value>::type>
236 std::forward<_Pair>(__x)),
this);
240 template<
typename _InputIterator>
242 insert(_InputIterator __first, _InputIterator __last)
244 __glibcxx_check_valid_range(__first, __last);
249 #ifdef __GXX_EXPERIMENTAL_CXX0X__
267 _Base::erase(__position.
base());
272 erase(
const key_type& __x)
275 _Base::equal_range(__x);
276 size_type __count = 0;
278 while (__victim != __victims.
second)
281 _Base::erase(__victim++);
287 #ifdef __GXX_EXPERIMENTAL_CXX0X__
295 __victim != __last.
base(); ++__victim)
297 _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(),
298 _M_message(__gnu_debug::__msg_valid_range)
299 ._M_iterator(__first,
"first")
300 ._M_iterator(__last,
"last"));
313 __victim != __last.
base(); ++__victim)
315 _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(),
316 _M_message(__gnu_debug::__msg_valid_range)
317 ._M_iterator(__first,
"first")
318 ._M_iterator(__last,
"last"));
321 _Base::erase(__first.
base(), __last.
base());
333 clear() _GLIBCXX_NOEXCEPT
335 this->_M_invalidate_all();
340 using _Base::key_comp;
341 using _Base::value_comp;
345 find(
const key_type& __x)
346 {
return iterator(_Base::find(__x),
this); }
349 find(
const key_type& __x)
const
355 lower_bound(
const key_type& __x)
356 {
return iterator(_Base::lower_bound(__x),
this); }
359 lower_bound(
const key_type& __x)
const
363 upper_bound(
const key_type& __x)
364 {
return iterator(_Base::upper_bound(__x),
this); }
367 upper_bound(
const key_type& __x)
const
371 equal_range(
const key_type& __x)
374 _Base::equal_range(__x);
380 equal_range(
const key_type& __x)
const
383 _Base::equal_range(__x);
389 _M_base() _GLIBCXX_NOEXCEPT {
return *
this; }
392 _M_base()
const _GLIBCXX_NOEXCEPT {
return *
this; }
403 template<
typename _Key,
typename _Tp,
404 typename _Compare,
typename _Allocator>
408 {
return __lhs._M_base() == __rhs._M_base(); }
410 template<
typename _Key,
typename _Tp,
411 typename _Compare,
typename _Allocator>
415 {
return __lhs._M_base() != __rhs._M_base(); }
417 template<
typename _Key,
typename _Tp,
418 typename _Compare,
typename _Allocator>
420 operator<(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
421 const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
422 {
return __lhs._M_base() < __rhs._M_base(); }
424 template<
typename _Key,
typename _Tp,
425 typename _Compare,
typename _Allocator>
427 operator<=(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
428 const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
429 {
return __lhs._M_base() <= __rhs._M_base(); }
431 template<
typename _Key,
typename _Tp,
432 typename _Compare,
typename _Allocator>
434 operator>=(
const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
435 const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
436 {
return __lhs._M_base() >= __rhs._M_base(); }
438 template<
typename _Key,
typename _Tp,
439 typename _Compare,
typename _Allocator>
441 operator>(
const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
442 const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
443 {
return __lhs._M_base() > __rhs._M_base(); }
445 template<
typename _Key,
typename _Tp,
446 typename _Compare,
typename _Allocator>
448 swap(multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
449 multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
450 { __lhs.swap(__rhs); }
_Siter_base< _Iterator >::iterator_type __base(_Iterator __it)
_T1 first
second_type is the second bound type
_T2 second
first is a copy of the first object
#define __glibcxx_check_erase_range(_First, _Last)
void _M_swap(_Safe_sequence_base &__x)
void _M_invalidate_if(_Predicate __pred)
_Iterator base() const
Return the underlying iterator.
#define __glibcxx_check_erase(_Position)
Class std::multimap with safety/checking/debug instrumentation.
Define a member typedef type only if a boolean constant is true.
size_t count() const _GLIBCXX_NOEXCEPT
Returns the number of bits which are set.
A standard container made up of (key,value) pairs, which can be retrieved based on a key...
#define __glibcxx_check_insert(_Position)
Struct holding two objects of arbitrary type.
Base class for constructing a safe sequence type that tracks iterators that reference it...
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.
is_nothrow_copy_constructible
constexpr size_t size() const _GLIBCXX_NOEXCEPT
Returns the total number of bits.