28 #ifndef _GLIBCXX_PROFILE_UNORDERED_SET
29 #define _GLIBCXX_PROFILE_UNORDERED_SET 1
31 #if __cplusplus < 201103L
39 #define _GLIBCXX_BASE unordered_set<_Key, _Hash, _Pred, _Alloc>
40 #define _GLIBCXX_STD_BASE _GLIBCXX_STD_C::_GLIBCXX_BASE
42 namespace std _GLIBCXX_VISIBILITY(default)
47 template<
typename _Key,
52 :
public _GLIBCXX_STD_BASE,
53 public _Unordered_profile<unordered_set<_Key, _Hash, _Pred, _Alloc>,
56 typedef _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;
75 typedef typename _Base::iterator iterator;
76 typedef typename _Base::const_iterator const_iterator;
80 const hasher& __hf = hasher(),
81 const key_equal& __eql = key_equal(),
82 const allocator_type& __a = allocator_type())
83 :
_Base(__n, __hf, __eql, __a)
86 template<
typename _InputIterator>
89 const hasher& __hf = hasher(),
90 const key_equal& __eql = key_equal(),
91 const allocator_type& __a = allocator_type())
92 :
_Base(__f, __l, __n, __hf, __eql, __a)
105 const hasher& __hf = hasher(),
106 const key_equal& __eql = key_equal(),
107 const allocator_type& __a = allocator_type())
108 :
_Base(__l, __n, __hf, __eql, __a)
126 { _Base::swap(__x); }
131 __profcxx_hashtable_destruct(
this, _Base::bucket_count(),
133 this->_M_profile_destruct();
137 template<
typename... _Args>
139 emplace(_Args&&... __args)
141 size_type __old_size = _Base::bucket_count();
143 = _Base::emplace(std::forward<_Args>(__args)...);
144 _M_profile_resize(__old_size);
148 template<
typename... _Args>
150 emplace_hint(const_iterator __it, _Args&&... __args)
152 size_type __old_size = _Base::bucket_count();
154 = _Base::emplace_hint(__it, std::forward<_Args>(__args)...);
155 _M_profile_resize(__old_size);
162 size_type __old_size = _Base::bucket_count();
164 _M_profile_resize(__old_size);
168 insert(
const value_type& __obj)
170 size_type __old_size = _Base::bucket_count();
172 _M_profile_resize(__old_size);
177 insert(const_iterator __iter,
const value_type& __v)
179 size_type __old_size = _Base::bucket_count();
180 iterator __res = _Base::insert(__iter, __v);
181 _M_profile_resize(__old_size);
186 insert(value_type&& __obj)
188 size_type __old_size = _Base::bucket_count();
190 _M_profile_resize(__old_size);
195 insert(const_iterator __iter, value_type&& __v)
197 size_type __old_size = _Base::bucket_count();
198 iterator __res = _Base::insert(__iter, std::move(__v));
199 _M_profile_resize(__old_size);
203 template<
typename _InputIter>
205 insert(_InputIter __first, _InputIter __last)
207 size_type __old_size = _Base::bucket_count();
208 _Base::insert(__first, __last);
209 _M_profile_resize(__old_size);
213 rehash(size_type __n)
215 size_type __old_size = _Base::bucket_count();
217 _M_profile_resize(__old_size);
222 _M_profile_resize(size_type __old_size)
224 size_type __new_size = _Base::bucket_count();
225 if (__old_size != __new_size)
226 __profcxx_hashtable_resize(
this, __old_size, __new_size);
230 template<
typename _Key,
typename _Hash,
typename _Pred,
typename _Alloc>
236 template<
typename _Key,
typename _Hash,
typename _Pred,
typename _Alloc>
240 {
return static_cast<const _GLIBCXX_STD_BASE&
>(__x) == __y; }
242 template<
typename _Key,
typename _Hash,
typename _Pred,
typename _Alloc>
244 operator!=(
const unordered_set<_Key, _Hash, _Pred, _Alloc>& __x,
245 const unordered_set<_Key, _Hash, _Pred, _Alloc>& __y)
246 {
return !(__x == __y); }
249 #undef _GLIBCXX_STD_BASE
250 #define _GLIBCXX_STD_BASE _GLIBCXX_STD_C::_GLIBCXX_BASE
251 #define _GLIBCXX_BASE unordered_multiset<_Value, _Hash, _Pred, _Alloc>
254 template<
typename _Value,
259 :
public _GLIBCXX_STD_BASE,
260 public _Unordered_profile<unordered_multiset<_Value,
261 _Hash, _Pred, _Alloc>,
264 typedef _GLIBCXX_STD_BASE
_Base;
267 _M_base() noexcept {
return *
this; }
270 _M_base()
const noexcept {
return *
this; }
273 typedef typename _Base::size_type size_type;
274 typedef typename _Base::hasher hasher;
275 typedef typename _Base::key_equal key_equal;
276 typedef typename _Base::allocator_type allocator_type;
277 typedef typename _Base::key_type key_type;
278 typedef typename _Base::value_type value_type;
279 typedef typename _Base::difference_type difference_type;
280 typedef typename _Base::reference reference;
281 typedef typename _Base::const_reference const_reference;
283 typedef typename _Base::iterator iterator;
284 typedef typename _Base::const_iterator const_iterator;
288 const hasher& __hf = hasher(),
289 const key_equal& __eql = key_equal(),
290 const allocator_type& __a = allocator_type())
291 :
_Base(__n, __hf, __eql, __a)
294 template<
typename _InputIterator>
297 const hasher& __hf = hasher(),
298 const key_equal& __eql = key_equal(),
299 const allocator_type& __a = allocator_type())
300 :
_Base(__f, __l, __n, __hf, __eql, __a)
313 const hasher& __hf = hasher(),
314 const key_equal& __eql = key_equal(),
315 const allocator_type& __a = allocator_type())
316 :
_Base(__l, __n, __hf, __eql, __a)
334 { _Base::swap(__x); }
339 __profcxx_hashtable_destruct(
this, _Base::bucket_count(),
341 this->_M_profile_destruct();
345 template<
typename... _Args>
347 emplace(_Args&&... __args)
349 size_type __old_size = _Base::bucket_count();
350 iterator __res = _Base::emplace(std::forward<_Args>(__args)...);
351 _M_profile_resize(__old_size);
355 template<
typename... _Args>
357 emplace_hint(const_iterator __it, _Args&&... __args)
359 size_type __old_size = _Base::bucket_count();
361 = _Base::emplace_hint(__it, std::forward<_Args>(__args)...);
362 _M_profile_resize(__old_size);
369 size_type __old_size = _Base::bucket_count();
371 _M_profile_resize(__old_size);
375 insert(
const value_type& __obj)
377 size_type __old_size = _Base::bucket_count();
378 iterator __res = _Base::insert(__obj);
379 _M_profile_resize(__old_size);
384 insert(const_iterator __iter,
const value_type& __v)
386 size_type __old_size = _Base::bucket_count();
387 iterator __res = _Base::insert(__iter, __v);
388 _M_profile_resize(__old_size);
393 insert(value_type&& __obj)
395 size_type __old_size = _Base::bucket_count();
396 iterator __res = _Base::insert(std::move(__obj));
397 _M_profile_resize(__old_size);
402 insert(const_iterator __iter, value_type&& __v)
404 size_type __old_size = _Base::bucket_count();
405 iterator __res = _Base::insert(__iter, std::move(__v));
406 _M_profile_resize(__old_size);
410 template<
typename _InputIter>
412 insert(_InputIter __first, _InputIter __last)
414 size_type __old_size = _Base::bucket_count();
415 _Base::insert(__first, __last);
416 _M_profile_resize(__old_size);
420 rehash(size_type __n)
422 size_type __old_size = _Base::bucket_count();
424 _M_profile_resize(__old_size);
429 _M_profile_resize(size_type __old_size)
431 size_type __new_size = _Base::bucket_count();
432 if (__old_size != __new_size)
433 __profcxx_hashtable_resize(
this, __old_size, __new_size);
437 template<
typename _Value,
typename _Hash,
typename _Pred,
typename _Alloc>
443 template<
typename _Value,
typename _Hash,
typename _Pred,
typename _Alloc>
447 {
return static_cast<const _GLIBCXX_STD_BASE&
>(__x) == __y; }
449 template<
typename _Value,
typename _Hash,
typename _Pred,
typename _Alloc>
451 operator!=(
const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
452 const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
453 {
return !(__x == __y); }
459 #undef _GLIBCXX_STD_BASE
A standard container composed of equivalent keys (possibly containing multiple of each key value) in ...
Unordered_set wrapper with performance instrumentation.
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.
Unordered_multiset wrapper with performance instrumentation.
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) in which the ...
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.