28 #ifndef _GLIBCXX_PROFILE_UNORDERED_MAP
29 #define _GLIBCXX_PROFILE_UNORDERED_MAP 1
31 #if __cplusplus < 201103L
39 #define _GLIBCXX_BASE unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>
40 #define _GLIBCXX_STD_BASE _GLIBCXX_STD_C::_GLIBCXX_BASE
42 namespace std _GLIBCXX_VISIBILITY(default)
47 template<
typename _Key,
typename _Tp,
52 :
public _GLIBCXX_STD_BASE,
53 public _Unordered_profile<unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>,
56 typedef typename _GLIBCXX_STD_BASE
_Base;
59 _M_base() noexcept {
return *
this; }
62 _M_base()
const noexcept {
return *
this; }
65 typedef typename _Base::size_type size_type;
66 typedef typename _Base::hasher hasher;
67 typedef typename _Base::key_equal key_equal;
68 typedef typename _Base::allocator_type allocator_type;
69 typedef typename _Base::key_type key_type;
70 typedef typename _Base::value_type value_type;
71 typedef typename _Base::difference_type difference_type;
72 typedef typename _Base::reference reference;
73 typedef typename _Base::const_reference const_reference;
74 typedef typename _Base::mapped_type mapped_type;
76 typedef typename _Base::iterator iterator;
77 typedef typename _Base::const_iterator const_iterator;
81 const hasher& __hf = hasher(),
82 const key_equal& __eql = key_equal(),
83 const allocator_type& __a = allocator_type())
84 :
_Base(__n, __hf, __eql, __a)
87 template<
typename _InputIterator>
90 const hasher& __hf = hasher(),
91 const key_equal& __eql = key_equal(),
92 const allocator_type& __a = allocator_type())
93 :
_Base(__f, __l, __n, __hf, __eql, __a)
106 const hasher& __hf = hasher(),
107 const key_equal& __eql = key_equal(),
108 const allocator_type& __a = allocator_type())
109 :
_Base(__l, __n, __hf, __eql, __a)
128 __profcxx_hashtable_destruct(
this, _Base::bucket_count(),
130 this->_M_profile_destruct();
134 template<
typename... _Args>
136 emplace(_Args&&... __args)
138 size_type __old_size = _Base::bucket_count();
140 = _Base::emplace(std::forward<_Args>(__args)...);
141 _M_profile_resize(__old_size);
145 template<
typename... _Args>
147 emplace_hint(const_iterator __it, _Args&&... __args)
149 size_type __old_size = _Base::bucket_count();
151 = _Base::emplace_hint(__it, std::forward<_Args>(__args)...);
152 _M_profile_resize(__old_size);
159 size_type __old_size = _Base::bucket_count();
161 _M_profile_resize(__old_size);
165 insert(
const value_type& __obj)
167 size_type __old_size = _Base::bucket_count();
169 _M_profile_resize(__old_size);
174 insert(const_iterator __iter,
const value_type& __v)
176 size_type __old_size = _Base::bucket_count();
177 iterator __res = _Base::insert(__iter, __v);
178 _M_profile_resize(__old_size);
182 template<
typename _Pair,
typename =
typename
184 _Pair&&>::value>::type>
186 insert(_Pair&& __obj)
188 size_type __old_size = _Base::bucket_count();
190 = _Base::insert(std::forward<_Pair>(__obj));
191 _M_profile_resize(__old_size);
195 template<
typename _Pair,
typename =
typename
197 _Pair&&>::value>::type>
199 insert(const_iterator __iter, _Pair&& __v)
201 size_type __old_size = _Base::bucket_count();
202 iterator __res = _Base::insert(__iter, std::forward<_Pair>(__v));
203 _M_profile_resize(__old_size);
207 template<
typename _InputIter>
209 insert(_InputIter __first, _InputIter __last)
211 size_type __old_size = _Base::bucket_count();
212 _Base::insert(__first, __last);
213 _M_profile_resize(__old_size);
218 operator[](
const _Key& __k)
220 size_type __old_size = _Base::bucket_count();
221 mapped_type& __res = _M_base()[__k];
222 _M_profile_resize(__old_size);
227 operator[](_Key&& __k)
229 size_type __old_size = _Base::bucket_count();
230 mapped_type& __res = _M_base()[std::move(__k)];
231 _M_profile_resize(__old_size);
237 { _Base::swap(__x._M_base()); }
239 void rehash(size_type __n)
241 size_type __old_size = _Base::bucket_count();
243 _M_profile_resize(__old_size);
248 _M_profile_resize(size_type __old_size)
250 size_type __new_size = _Base::bucket_count();
251 if (__old_size != __new_size)
252 __profcxx_hashtable_resize(
this, __old_size, __new_size);
256 template<
typename _Key,
typename _Tp,
typename _Hash,
257 typename _Pred,
typename _Alloc>
263 template<
typename _Key,
typename _Tp,
typename _Hash,
264 typename _Pred,
typename _Alloc>
268 {
return static_cast<const _GLIBCXX_STD_BASE&
>(__x) == __y; }
270 template<
typename _Key,
typename _Tp,
typename _Hash,
271 typename _Pred,
typename _Alloc>
273 operator!=(
const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
274 const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
275 {
return !(__x == __y); }
278 #undef _GLIBCXX_STD_BASE
279 #define _GLIBCXX_BASE unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>
280 #define _GLIBCXX_STD_BASE _GLIBCXX_STD_C::_GLIBCXX_BASE
283 template<
typename _Key,
typename _Tp,
288 :
public _GLIBCXX_STD_BASE,
289 public _Unordered_profile<unordered_multimap<_Key, _Tp,
290 _Hash, _Pred, _Alloc>,
293 typedef typename _GLIBCXX_STD_BASE
_Base;
296 _M_base() noexcept {
return *
this; }
299 _M_base()
const noexcept {
return *
this; }
302 typedef typename _Base::size_type size_type;
303 typedef typename _Base::hasher hasher;
304 typedef typename _Base::key_equal key_equal;
305 typedef typename _Base::allocator_type allocator_type;
306 typedef typename _Base::key_type key_type;
307 typedef typename _Base::value_type value_type;
308 typedef typename _Base::difference_type difference_type;
309 typedef typename _Base::reference reference;
310 typedef typename _Base::const_reference const_reference;
312 typedef typename _Base::iterator iterator;
313 typedef typename _Base::const_iterator const_iterator;
317 const hasher& __hf = hasher(),
318 const key_equal& __eql = key_equal(),
319 const allocator_type& __a = allocator_type())
320 :
_Base(__n, __hf, __eql, __a)
323 template<
typename _InputIterator>
326 const hasher& __hf = hasher(),
327 const key_equal& __eql = key_equal(),
328 const allocator_type& __a = allocator_type())
329 :
_Base(__f, __l, __n, __hf, __eql, __a)
342 const hasher& __hf = hasher(),
343 const key_equal& __eql = key_equal(),
344 const allocator_type& __a = allocator_type())
345 :
_Base(__l, __n, __hf, __eql, __a)
364 __profcxx_hashtable_destruct(
this, _Base::bucket_count(),
366 this->_M_profile_destruct();
370 template<
typename... _Args>
372 emplace(_Args&&... __args)
374 size_type __old_size = _Base::bucket_count();
376 = _Base::emplace(std::forward<_Args>(__args)...);
377 _M_profile_resize(__old_size);
381 template<
typename... _Args>
383 emplace_hint(const_iterator __it, _Args&&... __args)
385 size_type __old_size = _Base::bucket_count();
387 = _Base::emplace_hint(__it, std::forward<_Args>(__args)...);
388 _M_profile_resize(__old_size);
395 size_type __old_size = _Base::bucket_count();
397 _M_profile_resize(__old_size);
401 insert(
const value_type& __obj)
403 size_type __old_size = _Base::bucket_count();
404 iterator __res = _Base::insert(__obj);
405 _M_profile_resize(__old_size);
410 insert(const_iterator __iter,
const value_type& __v)
412 size_type __old_size = _Base::bucket_count();
413 iterator __res = _Base::insert(__iter, __v);
414 _M_profile_resize(__old_size);
418 template<
typename _Pair,
typename =
typename
420 _Pair&&>::value>::type>
422 insert(_Pair&& __obj)
424 size_type __old_size = _Base::bucket_count();
425 iterator __res = _Base::insert(std::forward<_Pair>(__obj));
426 _M_profile_resize(__old_size);
430 template<
typename _Pair,
typename =
typename
432 _Pair&&>::value>::type>
434 insert(const_iterator __iter, _Pair&& __v)
436 size_type __old_size = _Base::bucket_count();
437 iterator __res = _Base::insert(__iter, std::forward<_Pair>(__v));
438 _M_profile_resize(__old_size);
442 template<
typename _InputIter>
444 insert(_InputIter __first, _InputIter __last)
446 size_type __old_size = _Base::bucket_count();
447 _Base::insert(__first, __last);
448 _M_profile_resize(__old_size);
453 { _Base::swap(__x._M_base()); }
456 rehash(size_type __n)
458 size_type __old_size = _Base::bucket_count();
460 _M_profile_resize(__old_size);
465 _M_profile_resize(size_type __old_size)
467 size_type __new_size = _Base::bucket_count();
468 if (__old_size != __new_size)
469 __profcxx_hashtable_resize(
this, __old_size, __new_size);
473 template<
typename _Key,
typename _Tp,
typename _Hash,
474 typename _Pred,
typename _Alloc>
480 template<
typename _Key,
typename _Tp,
typename _Hash,
481 typename _Pred,
typename _Alloc>
485 {
return static_cast<const _GLIBCXX_STD_BASE&
>(__x) == __y; }
487 template<
typename _Key,
typename _Tp,
typename _Hash,
488 typename _Pred,
typename _Alloc>
490 operator!=(
const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
491 const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
492 {
return !(__x == __y); }
498 #undef _GLIBCXX_STD_BASE
Define a member typedef type only if a boolean constant is true.
Class std::unordered_map wrapper with performance instrumentation.
A standard container composed of equivalent keys (possibly containing multiple of each key value) tha...
Sequential helper functions. This file is a GNU profile extension to the Standard C++ Library...
Primary class template hash.
Struct holding two objects of arbitrary type.
One of the comparison functors.
constexpr size_t size() const noexcept
Returns the total number of bits.
A standard container composed of unique keys (containing at most one of each key value) that associat...
Class std::unordered_multimap wrapper with performance instrumentation.
The standard allocator, as per [20.4].
void swap(function< _Res(_Args...)> &__x, function< _Res(_Args...)> &__y)
Swap the targets of two polymorphic function object wrappers.