28 #ifndef _GLIBCXX_PROFILE_MAP_H
29 #define _GLIBCXX_PROFILE_MAP_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::map<_Key, _Tp, _Compare, _Allocator>
44 typedef _GLIBCXX_STD_C::map<_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::size_type size_type;
63 typedef typename _Base::difference_type difference_type;
64 typedef typename _Base::pointer pointer;
65 typedef typename _Base::const_pointer const_pointer;
73 { __profcxx_map_to_unordered_map_construct(
this); }
76 map(
const _Compare& __comp,
77 const _Allocator& __a = _Allocator())
79 { __profcxx_map_to_unordered_map_construct(
this); }
81 #if __cplusplus >= 201103L
82 template<
typename _InputIterator,
83 typename = std::_RequireInputIter<_InputIterator>>
85 template<
typename _InputIterator>
87 map(_InputIterator __first, _InputIterator __last,
88 const _Compare& __comp = _Compare(),
89 const _Allocator& __a = _Allocator())
90 : _Base(__first, __last, __comp, __a)
91 { __profcxx_map_to_unordered_map_construct(
this); }
95 { __profcxx_map_to_unordered_map_construct(
this); }
99 { __profcxx_map_to_unordered_map_construct(
this); }
101 #if __cplusplus >= 201103L
103 noexcept(is_nothrow_copy_constructible<_Compare>::value)
105 { __profcxx_map_to_unordered_map_construct(
this); }
107 map(initializer_list<value_type> __l,
108 const _Compare& __c = _Compare(),
109 const allocator_type& __a = allocator_type())
110 : _Base(__l, __c, __a)
111 { __profcxx_map_to_unordered_map_construct(
this); }
114 map(
const allocator_type& __a)
116 { __profcxx_map_to_unordered_map_construct(
this); }
118 map(
const map& __x,
const allocator_type& __a)
120 { __profcxx_map_to_unordered_map_construct(
this); }
122 map(map&& __x,
const allocator_type& __a)
123 noexcept(is_nothrow_copy_constructible<_Compare>::value
124 && _Alloc_traits::_S_always_equal())
126 { __profcxx_map_to_unordered_map_construct(
this); }
128 map(initializer_list<value_type> __l,
const allocator_type& __a)
130 { __profcxx_map_to_unordered_map_construct(
this); }
132 template<
typename _InputIterator>
133 map(_InputIterator __first, _InputIterator __last,
134 const allocator_type& __a)
135 : _Base(__first, __last, __a)
136 { __profcxx_map_to_unordered_map_construct(
this); }
139 ~map() _GLIBCXX_NOEXCEPT
140 { __profcxx_map_to_unordered_map_destruct(
this); }
142 #if __cplusplus < 201103L
144 operator=(
const map& __x)
151 operator=(
const map&) =
default;
154 operator=(map&&) =
default;
157 operator=(initializer_list<value_type> __l)
166 using _Base::get_allocator;
170 begin() _GLIBCXX_NOEXCEPT
171 {
return _Base::begin(); }
174 begin()
const _GLIBCXX_NOEXCEPT
175 {
return _Base::begin(); }
178 end() _GLIBCXX_NOEXCEPT
179 {
return _Base::end(); }
182 end()
const _GLIBCXX_NOEXCEPT
183 {
return _Base::end(); }
186 rbegin() _GLIBCXX_NOEXCEPT
188 __profcxx_map_to_unordered_map_invalidate(
this);
189 return reverse_iterator(end());
192 const_reverse_iterator
193 rbegin()
const _GLIBCXX_NOEXCEPT
195 __profcxx_map_to_unordered_map_invalidate(
this);
196 return const_reverse_iterator(end());
200 rend() _GLIBCXX_NOEXCEPT
202 __profcxx_map_to_unordered_map_invalidate(
this);
203 return reverse_iterator(begin());
206 const_reverse_iterator
207 rend()
const _GLIBCXX_NOEXCEPT
209 __profcxx_map_to_unordered_map_invalidate(
this);
210 return const_reverse_iterator(begin());
213 #if __cplusplus >= 201103L
215 cbegin()
const noexcept
216 {
return const_iterator(_Base::begin()); }
219 cend()
const noexcept
220 {
return const_iterator(_Base::end()); }
222 const_reverse_iterator
223 crbegin()
const noexcept
225 __profcxx_map_to_unordered_map_invalidate(
this);
226 return const_reverse_iterator(end());
229 const_reverse_iterator
230 crend()
const noexcept
232 __profcxx_map_to_unordered_map_invalidate(
this);
233 return const_reverse_iterator(begin());
240 using _Base::max_size;
244 operator[](
const key_type& __k)
246 __profcxx_map_to_unordered_map_find(
this, size());
247 return _Base::operator[](__k);
250 #if __cplusplus >= 201103L
252 operator[](key_type&& __k)
254 __profcxx_map_to_unordered_map_find(
this, size());
255 return _Base::operator[](
std::move(__k));
260 at(
const key_type& __k)
262 __profcxx_map_to_unordered_map_find(
this, size());
263 return _Base::at(__k);
267 at(
const key_type& __k)
const
269 __profcxx_map_to_unordered_map_find(
this, size());
270 return _Base::at(__k);
274 #if __cplusplus >= 201103L
275 template<
typename... _Args>
277 emplace(_Args&&... __args)
279 __profcxx_map_to_unordered_map_insert(
this, size(), 1);
280 auto __res = _Base::emplace(std::forward<_Args>(__args)...);
285 template<
typename... _Args>
287 emplace_hint(const_iterator __pos, _Args&&... __args)
289 size_type size_before = size();
290 auto __res = _Base::emplace_hint(__pos,
291 std::forward<_Args>(__args)...);
292 __profcxx_map_to_unordered_map_insert(
this, size_before,
293 size() - size_before);
299 insert(
const value_type& __x)
301 __profcxx_map_to_unordered_map_insert(
this, size(), 1);
302 typedef typename _Base::iterator _Base_iterator;
308 #if __cplusplus >= 201103L
309 template<
typename _Pair,
typename =
typename
310 std::enable_if<std::is_constructible<value_type,
311 _Pair&&>::value>::type>
315 __profcxx_map_to_unordered_map_insert(
this, size(), 1);
316 typedef typename _Base::iterator _Base_iterator;
318 = _Base::insert(std::forward<_Pair>(__x));
324 #if __cplusplus >= 201103L
326 insert(std::initializer_list<value_type> __list)
328 size_type size_before = size();
329 _Base::insert(__list);
330 __profcxx_map_to_unordered_map_insert(
this, size_before,
331 size() - size_before);
336 #if __cplusplus >= 201103L
337 insert(const_iterator __position,
const value_type& __x)
339 insert(iterator __position,
const value_type& __x)
342 size_type size_before = size();
343 iterator __i = iterator(_Base::insert(__position, __x));
344 __profcxx_map_to_unordered_map_insert(
this, size_before,
345 size() - size_before);
349 #if __cplusplus >= 201103L
350 template<
typename _Pair,
typename =
typename
351 std::enable_if<std::is_constructible<value_type,
352 _Pair&&>::value>::type>
354 insert(const_iterator __position, _Pair&& __x)
356 size_type size_before = size();
358 = iterator(_Base::insert(__position, std::forward<_Pair>(__x)));
359 __profcxx_map_to_unordered_map_insert(
this, size_before,
360 size() - size_before);
365 #if __cplusplus >= 201103L
366 template<
typename _InputIterator,
367 typename = std::_RequireInputIter<_InputIterator>>
369 template<
typename _InputIterator>
372 insert(_InputIterator __first, _InputIterator __last)
374 size_type size_before = size();
375 _Base::insert(__first, __last);
376 __profcxx_map_to_unordered_map_insert(
this, size_before,
377 size() - size_before);
380 #if __cplusplus >= 201103L
382 erase(const_iterator __position)
384 iterator __i = _Base::erase(__position);
385 __profcxx_map_to_unordered_map_erase(
this, size(), 1);
390 erase(iterator __position)
391 {
return erase(const_iterator(__position)); }
394 erase(iterator __position)
396 _Base::erase(__position);
397 __profcxx_map_to_unordered_map_erase(
this, size(), 1);
402 erase(
const key_type& __x)
404 iterator __victim = find(__x);
405 if (__victim == end())
409 _Base::erase(__victim);
414 #if __cplusplus >= 201103L
416 erase(const_iterator __first, const_iterator __last)
417 {
return iterator(_Base::erase(__first, __last)); }
420 erase(iterator __first, iterator __last)
421 { _Base::erase(__first, __last); }
426 #if __cplusplus >= 201103L
427 noexcept(_Alloc_traits::_S_nothrow_swap())
429 { _Base::swap(__x); }
432 clear() _GLIBCXX_NOEXCEPT
433 { this->erase(begin(), end()); }
436 using _Base::key_comp;
437 using _Base::value_comp;
441 find(
const key_type& __x)
443 __profcxx_map_to_unordered_map_find(
this, size());
444 return iterator(_Base::find(__x));
448 find(
const key_type& __x)
const
450 __profcxx_map_to_unordered_map_find(
this, size());
451 return const_iterator(_Base::find(__x));
455 count(
const key_type& __x)
const
457 __profcxx_map_to_unordered_map_find(
this, size());
458 return _Base::count(__x);
462 lower_bound(
const key_type& __x)
464 __profcxx_map_to_unordered_map_invalidate(
this);
465 return iterator(_Base::lower_bound(__x));
469 lower_bound(
const key_type& __x)
const
471 __profcxx_map_to_unordered_map_invalidate(
this);
472 return const_iterator(_Base::lower_bound(__x));
476 upper_bound(
const key_type& __x)
478 __profcxx_map_to_unordered_map_invalidate(
this);
479 return iterator(_Base::upper_bound(__x));
483 upper_bound(
const key_type& __x)
const
485 __profcxx_map_to_unordered_map_invalidate(
this);
486 return const_iterator(_Base::upper_bound(__x));
490 equal_range(
const key_type& __x)
492 typedef typename _Base::iterator _Base_iterator;
494 _Base::equal_range(__x);
500 equal_range(
const key_type& __x)
const
502 __profcxx_map_to_unordered_map_find(
this, size());
503 typedef typename _Base::const_iterator _Base_const_iterator;
505 _Base::equal_range(__x);
507 const_iterator(__res.
second));
511 _M_base() _GLIBCXX_NOEXCEPT {
return *
this; }
514 _M_base()
const _GLIBCXX_NOEXCEPT {
return *
this; }
518 template<
typename _Key,
typename _Tp,
519 typename _Compare,
typename _Allocator>
524 __profcxx_map_to_unordered_map_invalidate(&__lhs);
525 __profcxx_map_to_unordered_map_invalidate(&__rhs);
526 return __lhs._M_base() == __rhs._M_base();
529 template<
typename _Key,
typename _Tp,
530 typename _Compare,
typename _Allocator>
535 __profcxx_map_to_unordered_map_invalidate(&__lhs);
536 __profcxx_map_to_unordered_map_invalidate(&__rhs);
537 return __lhs._M_base() != __rhs._M_base();
540 template<
typename _Key,
typename _Tp,
541 typename _Compare,
typename _Allocator>
543 operator<(const map<_Key, _Tp, _Compare, _Allocator>& __lhs,
544 const map<_Key, _Tp, _Compare, _Allocator>& __rhs)
546 __profcxx_map_to_unordered_map_invalidate(&__lhs);
547 __profcxx_map_to_unordered_map_invalidate(&__rhs);
548 return __lhs._M_base() < __rhs._M_base();
551 template<
typename _Key,
typename _Tp,
552 typename _Compare,
typename _Allocator>
554 operator<=(const map<_Key, _Tp, _Compare, _Allocator>& __lhs,
555 const map<_Key, _Tp, _Compare, _Allocator>& __rhs)
557 __profcxx_map_to_unordered_map_invalidate(&__lhs);
558 __profcxx_map_to_unordered_map_invalidate(&__rhs);
559 return __lhs._M_base() <= __rhs._M_base();
562 template<
typename _Key,
typename _Tp,
563 typename _Compare,
typename _Allocator>
565 operator>=(
const map<_Key, _Tp, _Compare, _Allocator>& __lhs,
566 const map<_Key, _Tp, _Compare, _Allocator>& __rhs)
568 __profcxx_map_to_unordered_map_invalidate(&__lhs);
569 __profcxx_map_to_unordered_map_invalidate(&__rhs);
570 return __lhs._M_base() >= __rhs._M_base();
573 template<
typename _Key,
typename _Tp,
574 typename _Compare,
typename _Allocator>
576 operator>(
const map<_Key, _Tp, _Compare, _Allocator>& __lhs,
577 const map<_Key, _Tp, _Compare, _Allocator>& __rhs)
579 __profcxx_map_to_unordered_map_invalidate(&__lhs);
580 __profcxx_map_to_unordered_map_invalidate(&__rhs);
581 return __lhs._M_base() > __rhs._M_base();
584 template<
typename _Key,
typename _Tp,
585 typename _Compare,
typename _Allocator>
587 swap(map<_Key, _Tp, _Compare, _Allocator>& __lhs,
588 map<_Key, _Tp, _Compare, _Allocator>& __rhs)
589 { __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.
Class std::map wrapper with performance instrumentation.
Sequential helper functions. This file is a GNU profile extension to the Standard C++ Library...
_T1 first
second_type is the second bound type
A standard container made up of (key,value) pairs, which can be retrieved based on a key...
ISO C++ entities toplevel namespace is std.
bool operator>=(const basic_string< _CharT, _Traits, _Alloc > &__lhs, const basic_string< _CharT, _Traits, _Alloc > &__rhs)
Test if string doesn't precede string.
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