29 #ifndef _GLIBCXX_PROFILE_MULTIMAP_H
30 #define _GLIBCXX_PROFILE_MULTIMAP_H 1
34 namespace std _GLIBCXX_VISIBILITY(default)
39 template<
typename _Key,
typename _Tp,
typename _Compare = std::less<_Key>,
40 typename _Allocator = std::allocator<std::pair<const _Key, _Tp> > >
42 :
public _GLIBCXX_STD_C::multimap<_Key, _Tp, _Compare, _Allocator>
44 typedef _GLIBCXX_STD_C::multimap<_Key, _Tp, _Compare, _Allocator>
_Base;
46 #if __cplusplus >= 201103L
52 typedef _Key key_type;
53 typedef _Tp mapped_type;
55 typedef _Compare key_compare;
56 typedef _Allocator allocator_type;
57 typedef typename _Base::reference reference;
58 typedef typename _Base::const_reference const_reference;
60 typedef typename _Base::iterator iterator;
61 typedef typename _Base::const_iterator const_iterator;
62 typedef typename _Base::reverse_iterator reverse_iterator;
63 typedef typename _Base::const_reverse_iterator const_reverse_iterator;
65 typedef typename _Base::size_type size_type;
66 typedef typename _Base::difference_type difference_type;
67 typedef typename _Base::pointer pointer;
68 typedef typename _Base::const_pointer const_pointer;
75 explicit multimap(
const _Compare& __comp,
76 const _Allocator& __a = _Allocator())
77 : _Base(__comp, __a) { }
79 #if __cplusplus >= 201103L
80 template<
typename _InputIterator,
81 typename = std::_RequireInputIter<_InputIterator>>
83 template<
typename _InputIterator>
85 multimap(_InputIterator __first, _InputIterator __last,
86 const _Compare& __comp = _Compare(),
87 const _Allocator& __a = _Allocator())
88 : _Base(__first, __last, __comp, __a) { }
90 #if __cplusplus < 201103L
91 multimap(
const multimap& __x)
94 multimap(
const multimap&) =
default;
95 multimap(multimap&&) =
default;
97 multimap(initializer_list<value_type> __l,
98 const _Compare& __c = _Compare(),
99 const allocator_type& __a = allocator_type())
100 : _Base(__l, __c, __a) { }
103 multimap(
const allocator_type& __a)
106 multimap(
const multimap& __x,
const allocator_type& __a)
107 : _Base(__x, __a) { }
109 multimap(multimap&& __x,
const allocator_type& __a)
110 noexcept(is_nothrow_copy_constructible<_Compare>::value
111 && _Alloc_traits::_S_always_equal())
114 multimap(initializer_list<value_type> __l,
const allocator_type& __a)
115 : _Base(__l, __a) { }
117 template<
typename _InputIterator>
118 multimap(_InputIterator __first, _InputIterator __last,
119 const allocator_type& __a)
120 : _Base(__first, __last, __a) { }
123 multimap(
const _Base& __x)
126 ~multimap() _GLIBCXX_NOEXCEPT { }
128 #if __cplusplus < 201103L
130 operator=(
const multimap& __x)
137 operator=(
const multimap&) =
default;
140 operator=(multimap&&) =
default;
143 operator=(initializer_list<value_type> __l)
150 using _Base::get_allocator;
154 begin() _GLIBCXX_NOEXCEPT
155 {
return iterator(_Base::begin()); }
158 begin()
const _GLIBCXX_NOEXCEPT
159 {
return const_iterator(_Base::begin()); }
162 end() _GLIBCXX_NOEXCEPT
163 {
return iterator(_Base::end()); }
166 end()
const _GLIBCXX_NOEXCEPT
167 {
return const_iterator(_Base::end()); }
170 rbegin() _GLIBCXX_NOEXCEPT
171 {
return reverse_iterator(end()); }
173 const_reverse_iterator
174 rbegin()
const _GLIBCXX_NOEXCEPT
175 {
return const_reverse_iterator(end()); }
178 rend() _GLIBCXX_NOEXCEPT
179 {
return reverse_iterator(begin()); }
181 const_reverse_iterator
182 rend()
const _GLIBCXX_NOEXCEPT
183 {
return const_reverse_iterator(begin()); }
185 #if __cplusplus >= 201103L
187 cbegin()
const noexcept
188 {
return const_iterator(_Base::begin()); }
191 cend()
const noexcept
192 {
return const_iterator(_Base::end()); }
194 const_reverse_iterator
195 crbegin()
const noexcept
196 {
return const_reverse_iterator(end()); }
198 const_reverse_iterator
199 crend()
const noexcept
200 {
return const_reverse_iterator(begin()); }
206 using _Base::max_size;
209 #if __cplusplus >= 201103L
210 template<
typename... _Args>
212 emplace(_Args&&... __args)
214 return iterator(_Base::emplace(std::forward<_Args>(__args)...));
217 template<
typename... _Args>
219 emplace_hint(const_iterator __pos, _Args&&... __args)
221 return iterator(_Base::emplace_hint(__pos,
222 std::forward<_Args>(__args)...));
227 insert(
const value_type& __x)
228 {
return iterator(_Base::insert(__x)); }
230 #if __cplusplus >= 201103L
231 template<
typename _Pair,
typename =
typename
232 std::enable_if<std::is_constructible<value_type,
233 _Pair&&>::value>::type>
236 {
return iterator(_Base::insert(std::forward<_Pair>(__x))); }
239 #if __cplusplus >= 201103L
241 insert(std::initializer_list<value_type> __list)
242 { _Base::insert(__list); }
246 #if __cplusplus >= 201103L
247 insert(const_iterator __position,
const value_type& __x)
249 insert(iterator __position,
const value_type& __x)
251 {
return iterator(_Base::insert(__position, __x)); }
253 #if __cplusplus >= 201103L
254 template<
typename _Pair,
typename =
typename
255 std::enable_if<std::is_constructible<value_type,
256 _Pair&&>::value>::type>
258 insert(const_iterator __position, _Pair&& __x)
259 {
return iterator(_Base::insert(__position,
260 std::forward<_Pair>(__x))); }
263 #if __cplusplus >= 201103L
264 template<
typename _InputIterator,
265 typename = std::_RequireInputIter<_InputIterator>>
267 template<
typename _InputIterator>
270 insert(_InputIterator __first, _InputIterator __last)
271 { _Base::insert(__first, __last); }
273 #if __cplusplus >= 201103L
275 erase(const_iterator __position)
276 {
return iterator(_Base::erase(__position)); }
279 erase(iterator __position)
280 {
return iterator(_Base::erase(__position)); }
283 erase(iterator __position)
284 { _Base::erase(__position); }
288 erase(
const key_type& __x)
291 size_type __count = 0;
294 iterator __victim = __victims.
first++;
295 _Base::erase(__victim);
301 #if __cplusplus >= 201103L
303 erase(const_iterator __first, const_iterator __last)
304 {
return iterator(_Base::erase(__first, __last)); }
307 erase(iterator __first, iterator __last)
308 { _Base::erase(__first, __last); }
313 #if __cplusplus >= 201103L
314 noexcept(_Alloc_traits::_S_nothrow_swap())
316 { _Base::swap(__x); }
319 clear() _GLIBCXX_NOEXCEPT
320 { this->erase(begin(), end()); }
323 using _Base::key_comp;
324 using _Base::value_comp;
328 find(
const key_type& __x)
329 {
return iterator(_Base::find(__x)); }
332 find(
const key_type& __x)
const
333 {
return const_iterator(_Base::find(__x)); }
338 lower_bound(
const key_type& __x)
339 {
return iterator(_Base::lower_bound(__x)); }
342 lower_bound(
const key_type& __x)
const
343 {
return const_iterator(_Base::lower_bound(__x)); }
346 upper_bound(
const key_type& __x)
347 {
return iterator(_Base::upper_bound(__x)); }
350 upper_bound(
const key_type& __x)
const
351 {
return const_iterator(_Base::upper_bound(__x)); }
354 equal_range(
const key_type& __x)
356 typedef typename _Base::iterator _Base_iterator;
358 _Base::equal_range(__x);
364 equal_range(
const key_type& __x)
const
366 typedef typename _Base::const_iterator _Base_const_iterator;
368 _Base::equal_range(__x);
370 const_iterator(__res.
second));
374 _M_base() _GLIBCXX_NOEXCEPT {
return *
this; }
377 _M_base()
const _GLIBCXX_NOEXCEPT {
return *
this; }
380 template<
typename _Key,
typename _Tp,
381 typename _Compare,
typename _Allocator>
385 {
return __lhs._M_base() == __rhs._M_base(); }
387 template<
typename _Key,
typename _Tp,
388 typename _Compare,
typename _Allocator>
392 {
return __lhs._M_base() != __rhs._M_base(); }
394 template<
typename _Key,
typename _Tp,
395 typename _Compare,
typename _Allocator>
397 operator<(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
398 const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
399 {
return __lhs._M_base() < __rhs._M_base(); }
401 template<
typename _Key,
typename _Tp,
402 typename _Compare,
typename _Allocator>
404 operator<=(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
405 const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
406 {
return __lhs._M_base() <= __rhs._M_base(); }
408 template<
typename _Key,
typename _Tp,
409 typename _Compare,
typename _Allocator>
411 operator>=(
const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
412 const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
413 {
return __lhs._M_base() >= __rhs._M_base(); }
415 template<
typename _Key,
typename _Tp,
416 typename _Compare,
typename _Allocator>
418 operator>(
const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
419 const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
420 {
return __lhs._M_base() > __rhs._M_base(); }
422 template<
typename _Key,
typename _Tp,
423 typename _Compare,
typename _Allocator>
425 swap(multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
426 multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
427 { __lhs.swap(__rhs); }
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
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.
Uniform interface to C++98 and C++0x allocators.
_T1 first
second_type is the second bound type
ISO C++ entities toplevel namespace is std.
Class std::multimap wrapper with performance instrumentation.
bool operator>=(const basic_string< _CharT, _Traits, _Alloc > &__lhs, const basic_string< _CharT, _Traits, _Alloc > &__rhs)
Test if string doesn't precede string.
A standard container made up of (key,value) pairs, which can be retrieved based on a key...
bool operator>(const basic_string< _CharT, _Traits, _Alloc > &__lhs, const basic_string< _CharT, _Traits, _Alloc > &__rhs)
Test if string follows string.
Struct holding two objects of arbitrary type.
void swap(_Tp &, _Tp &) noexcept(__and_< is_nothrow_move_constructible< _Tp >, is_nothrow_move_assignable< _Tp >>::value)
Swaps two values.
_T2 second
first is a copy of the first object