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;
48 typedef _Key key_type;
49 typedef _Tp mapped_type;
51 typedef _Compare key_compare;
52 typedef _Allocator allocator_type;
53 typedef typename _Base::reference reference;
54 typedef typename _Base::const_reference const_reference;
56 typedef typename _Base::iterator iterator;
57 typedef typename _Base::const_iterator const_iterator;
58 typedef typename _Base::reverse_iterator reverse_iterator;
59 typedef typename _Base::const_reverse_iterator const_reverse_iterator;
61 typedef typename _Base::size_type size_type;
62 typedef typename _Base::difference_type difference_type;
63 typedef typename _Base::pointer pointer;
64 typedef typename _Base::const_pointer const_pointer;
67 explicit multimap(
const _Compare& __comp = _Compare(),
68 const _Allocator& __a = _Allocator())
69 :
_Base(__comp, __a) { }
71 #if __cplusplus >= 201103L
72 template<
typename _InputIterator,
73 typename = std::_RequireInputIter<_InputIterator>>
75 template<
typename _InputIterator>
77 multimap(_InputIterator __first, _InputIterator __last,
78 const _Compare& __comp = _Compare(),
79 const _Allocator& __a = _Allocator())
80 :
_Base(__first, __last, __comp, __a) { }
82 multimap(
const multimap& __x)
85 multimap(
const _Base& __x)
88 #if __cplusplus >= 201103L
89 multimap(multimap&& __x)
90 noexcept(is_nothrow_copy_constructible<_Compare>::value)
91 :
_Base(std::move(__x))
95 const _Compare& __c = _Compare(),
96 const allocator_type& __a = allocator_type())
97 :
_Base(__l, __c, __a) { }
100 ~multimap() _GLIBCXX_NOEXCEPT { }
103 operator=(
const multimap& __x)
105 *
static_cast<_Base*
>(
this) = __x;
109 #if __cplusplus >= 201103L
111 operator=(multimap&& __x)
129 using _Base::get_allocator;
133 begin() _GLIBCXX_NOEXCEPT
134 {
return iterator(_Base::begin()); }
137 begin()
const _GLIBCXX_NOEXCEPT
138 {
return const_iterator(_Base::begin()); }
141 end() _GLIBCXX_NOEXCEPT
142 {
return iterator(_Base::end()); }
145 end()
const _GLIBCXX_NOEXCEPT
146 {
return const_iterator(_Base::end()); }
149 rbegin() _GLIBCXX_NOEXCEPT
150 {
return reverse_iterator(end()); }
152 const_reverse_iterator
153 rbegin()
const _GLIBCXX_NOEXCEPT
154 {
return const_reverse_iterator(end()); }
157 rend() _GLIBCXX_NOEXCEPT
158 {
return reverse_iterator(begin()); }
160 const_reverse_iterator
161 rend()
const _GLIBCXX_NOEXCEPT
162 {
return const_reverse_iterator(begin()); }
164 #if __cplusplus >= 201103L
166 cbegin()
const noexcept
167 {
return const_iterator(_Base::begin()); }
170 cend()
const noexcept
171 {
return const_iterator(_Base::end()); }
173 const_reverse_iterator
174 crbegin()
const noexcept
175 {
return const_reverse_iterator(end()); }
177 const_reverse_iterator
178 crend()
const noexcept
179 {
return const_reverse_iterator(begin()); }
185 using _Base::max_size;
188 #if __cplusplus >= 201103L
189 template<
typename... _Args>
191 emplace(_Args&&... __args)
193 return iterator(_Base::emplace(std::forward<_Args>(__args)...));
196 template<
typename... _Args>
198 emplace_hint(const_iterator __pos, _Args&&... __args)
200 return iterator(_Base::emplace_hint(__pos,
201 std::forward<_Args>(__args)...));
207 {
return iterator(_Base::insert(__x)); }
209 #if __cplusplus >= 201103L
210 template<
typename _Pair,
typename =
typename
211 std::enable_if<std::is_constructible<
value_type,
212 _Pair&&>::value>::type>
215 {
return iterator(_Base::insert(std::forward<_Pair>(__x))); }
218 #if __cplusplus >= 201103L
221 { _Base::insert(__list); }
225 #if __cplusplus >= 201103L
226 insert(const_iterator __position,
const value_type& __x)
228 insert(iterator __position,
const value_type& __x)
230 {
return iterator(_Base::insert(__position, __x)); }
232 #if __cplusplus >= 201103L
233 template<
typename _Pair,
typename =
typename
234 std::enable_if<std::is_constructible<
value_type,
235 _Pair&&>::value>::type>
237 insert(const_iterator __position, _Pair&& __x)
238 {
return iterator(_Base::insert(__position,
239 std::forward<_Pair>(__x))); }
242 #if __cplusplus >= 201103L
243 template<
typename _InputIterator,
244 typename = std::_RequireInputIter<_InputIterator>>
246 template<
typename _InputIterator>
249 insert(_InputIterator __first, _InputIterator __last)
250 { _Base::insert(__first, __last); }
252 #if __cplusplus >= 201103L
254 erase(const_iterator __position)
255 {
return iterator(_Base::erase(__position)); }
258 erase(iterator __position)
259 {
return iterator(_Base::erase(__position)); }
262 erase(iterator __position)
263 { _Base::erase(__position); }
267 erase(
const key_type& __x)
270 size_type __count = 0;
273 iterator __victim = __victims.
first++;
274 _Base::erase(__victim);
280 #if __cplusplus >= 201103L
282 erase(const_iterator __first, const_iterator __last)
283 {
return iterator(_Base::erase(__first, __last)); }
286 erase(iterator __first, iterator __last)
287 { _Base::erase(__first, __last); }
292 { _Base::swap(__x); }
295 clear() _GLIBCXX_NOEXCEPT
296 { this->erase(begin(), end()); }
299 using _Base::key_comp;
300 using _Base::value_comp;
304 find(
const key_type& __x)
305 {
return iterator(_Base::find(__x)); }
308 find(
const key_type& __x)
const
309 {
return const_iterator(_Base::find(__x)); }
314 lower_bound(
const key_type& __x)
315 {
return iterator(_Base::lower_bound(__x)); }
318 lower_bound(
const key_type& __x)
const
319 {
return const_iterator(_Base::lower_bound(__x)); }
322 upper_bound(
const key_type& __x)
323 {
return iterator(_Base::upper_bound(__x)); }
326 upper_bound(
const key_type& __x)
const
327 {
return const_iterator(_Base::upper_bound(__x)); }
330 equal_range(
const key_type& __x)
332 typedef typename _Base::iterator _Base_iterator;
334 _Base::equal_range(__x);
340 equal_range(
const key_type& __x)
const
342 typedef typename _Base::const_iterator _Base_const_iterator;
344 _Base::equal_range(__x);
346 const_iterator(__res.
second));
350 _M_base() _GLIBCXX_NOEXCEPT {
return *
this; }
353 _M_base()
const _GLIBCXX_NOEXCEPT {
return *
this; }
356 template<
typename _Key,
typename _Tp,
357 typename _Compare,
typename _Allocator>
361 {
return __lhs._M_base() == __rhs._M_base(); }
363 template<
typename _Key,
typename _Tp,
364 typename _Compare,
typename _Allocator>
368 {
return __lhs._M_base() != __rhs._M_base(); }
370 template<
typename _Key,
typename _Tp,
371 typename _Compare,
typename _Allocator>
373 operator<(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
374 const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
375 {
return __lhs._M_base() < __rhs._M_base(); }
377 template<
typename _Key,
typename _Tp,
378 typename _Compare,
typename _Allocator>
380 operator<=(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
381 const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
382 {
return __lhs._M_base() <= __rhs._M_base(); }
384 template<
typename _Key,
typename _Tp,
385 typename _Compare,
typename _Allocator>
387 operator>=(
const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
388 const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
389 {
return __lhs._M_base() >= __rhs._M_base(); }
391 template<
typename _Key,
typename _Tp,
392 typename _Compare,
typename _Allocator>
394 operator>(
const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
395 const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
396 {
return __lhs._M_base() > __rhs._M_base(); }
398 template<
typename _Key,
typename _Tp,
399 typename _Compare,
typename _Allocator>
401 swap(multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
402 multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
403 { __lhs.swap(__rhs); }
_T2 second
first is a copy of the first object
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
constexpr size_t size() const noexcept
Returns the total number of bits.
Struct holding two objects of arbitrary type.
A standard container made up of (key,value) pairs, which can be retrieved based on a key...
size_t count() const noexcept
Returns the number of bits which are set.
Class std::multimap wrapper with performance instrumentation.
void swap(function< _Res(_Args...)> &__x, function< _Res(_Args...)> &__y)
Swap the targets of two polymorphic function object wrappers.