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)
109 const allocator_type& __a)
110 :
_Base(__uset._M_base(), __a)
114 const allocator_type& __a)
115 :
_Base(std::move(__uset._M_base()), __a)
120 const hasher& __hf = hasher(),
121 const key_equal& __eql = key_equal(),
122 const allocator_type& __a = allocator_type())
123 :
_Base(__l, __n, __hf, __eql, __a)
141 noexcept( noexcept(__x._M_base().swap(__x)) )
147 __profcxx_hashtable_destruct(
this, _Base::bucket_count(),
149 this->_M_profile_destruct();
153 template<
typename... _Args>
155 emplace(_Args&&... __args)
157 size_type __old_size = _Base::bucket_count();
159 = _Base::emplace(std::forward<_Args>(__args)...);
160 _M_profile_resize(__old_size);
164 template<
typename... _Args>
166 emplace_hint(const_iterator __it, _Args&&... __args)
168 size_type __old_size = _Base::bucket_count();
170 = _Base::emplace_hint(__it, std::forward<_Args>(__args)...);
171 _M_profile_resize(__old_size);
178 size_type __old_size = _Base::bucket_count();
180 _M_profile_resize(__old_size);
184 insert(
const value_type& __obj)
186 size_type __old_size = _Base::bucket_count();
188 _M_profile_resize(__old_size);
193 insert(const_iterator __iter,
const value_type& __v)
195 size_type __old_size = _Base::bucket_count();
196 iterator __res = _Base::insert(__iter, __v);
197 _M_profile_resize(__old_size);
202 insert(value_type&& __obj)
204 size_type __old_size = _Base::bucket_count();
206 _M_profile_resize(__old_size);
211 insert(const_iterator __iter, value_type&& __v)
213 size_type __old_size = _Base::bucket_count();
214 iterator __res = _Base::insert(__iter, std::move(__v));
215 _M_profile_resize(__old_size);
219 template<
typename _InputIter>
221 insert(_InputIter __first, _InputIter __last)
223 size_type __old_size = _Base::bucket_count();
224 _Base::insert(__first, __last);
225 _M_profile_resize(__old_size);
229 rehash(size_type __n)
231 size_type __old_size = _Base::bucket_count();
233 _M_profile_resize(__old_size);
238 _M_profile_resize(size_type __old_size)
240 size_type __new_size = _Base::bucket_count();
241 if (__old_size != __new_size)
242 __profcxx_hashtable_resize(
this, __old_size, __new_size);
246 template<
typename _Key,
typename _Hash,
typename _Pred,
typename _Alloc>
252 template<
typename _Key,
typename _Hash,
typename _Pred,
typename _Alloc>
256 {
return static_cast<const _GLIBCXX_STD_BASE&
>(__x) == __y; }
258 template<
typename _Key,
typename _Hash,
typename _Pred,
typename _Alloc>
260 operator!=(
const unordered_set<_Key, _Hash, _Pred, _Alloc>& __x,
261 const unordered_set<_Key, _Hash, _Pred, _Alloc>& __y)
262 {
return !(__x == __y); }
265 #undef _GLIBCXX_STD_BASE
266 #define _GLIBCXX_STD_BASE _GLIBCXX_STD_C::_GLIBCXX_BASE
267 #define _GLIBCXX_BASE unordered_multiset<_Value, _Hash, _Pred, _Alloc>
270 template<
typename _Value,
275 :
public _GLIBCXX_STD_BASE,
276 public _Unordered_profile<unordered_multiset<_Value,
277 _Hash, _Pred, _Alloc>,
280 typedef _GLIBCXX_STD_BASE
_Base;
283 _M_base() noexcept {
return *
this; }
286 _M_base()
const noexcept {
return *
this; }
289 typedef typename _Base::size_type size_type;
290 typedef typename _Base::hasher hasher;
291 typedef typename _Base::key_equal key_equal;
292 typedef typename _Base::allocator_type allocator_type;
293 typedef typename _Base::key_type key_type;
294 typedef typename _Base::value_type value_type;
295 typedef typename _Base::difference_type difference_type;
296 typedef typename _Base::reference reference;
297 typedef typename _Base::const_reference const_reference;
299 typedef typename _Base::iterator iterator;
300 typedef typename _Base::const_iterator const_iterator;
304 const hasher& __hf = hasher(),
305 const key_equal& __eql = key_equal(),
306 const allocator_type& __a = allocator_type())
307 :
_Base(__n, __hf, __eql, __a)
310 template<
typename _InputIterator>
313 const hasher& __hf = hasher(),
314 const key_equal& __eql = key_equal(),
315 const allocator_type& __a = allocator_type())
316 :
_Base(__f, __l, __n, __hf, __eql, __a)
333 const allocator_type& __a)
334 :
_Base(__umset._M_base(), __a)
338 const allocator_type& __a)
339 :
_Base(std::move(__umset._M_base()), __a)
344 const hasher& __hf = hasher(),
345 const key_equal& __eql = key_equal(),
346 const allocator_type& __a = allocator_type())
347 :
_Base(__l, __n, __hf, __eql, __a)
365 noexcept( noexcept(__x._M_base().swap(__x)) )
371 __profcxx_hashtable_destruct(
this, _Base::bucket_count(),
373 this->_M_profile_destruct();
377 template<
typename... _Args>
379 emplace(_Args&&... __args)
381 size_type __old_size = _Base::bucket_count();
382 iterator __res = _Base::emplace(std::forward<_Args>(__args)...);
383 _M_profile_resize(__old_size);
387 template<
typename... _Args>
389 emplace_hint(const_iterator __it, _Args&&... __args)
391 size_type __old_size = _Base::bucket_count();
393 = _Base::emplace_hint(__it, std::forward<_Args>(__args)...);
394 _M_profile_resize(__old_size);
401 size_type __old_size = _Base::bucket_count();
403 _M_profile_resize(__old_size);
407 insert(
const value_type& __obj)
409 size_type __old_size = _Base::bucket_count();
410 iterator __res = _Base::insert(__obj);
411 _M_profile_resize(__old_size);
416 insert(const_iterator __iter,
const value_type& __v)
418 size_type __old_size = _Base::bucket_count();
419 iterator __res = _Base::insert(__iter, __v);
420 _M_profile_resize(__old_size);
425 insert(value_type&& __obj)
427 size_type __old_size = _Base::bucket_count();
428 iterator __res = _Base::insert(std::move(__obj));
429 _M_profile_resize(__old_size);
434 insert(const_iterator __iter, value_type&& __v)
436 size_type __old_size = _Base::bucket_count();
437 iterator __res = _Base::insert(__iter, std::move(__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);
452 rehash(size_type __n)
454 size_type __old_size = _Base::bucket_count();
456 _M_profile_resize(__old_size);
461 _M_profile_resize(size_type __old_size)
463 size_type __new_size = _Base::bucket_count();
464 if (__old_size != __new_size)
465 __profcxx_hashtable_resize(
this, __old_size, __new_size);
469 template<
typename _Value,
typename _Hash,
typename _Pred,
typename _Alloc>
475 template<
typename _Value,
typename _Hash,
typename _Pred,
typename _Alloc>
479 {
return static_cast<const _GLIBCXX_STD_BASE&
>(__x) == __y; }
481 template<
typename _Value,
typename _Hash,
typename _Pred,
typename _Alloc>
483 operator!=(
const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
484 const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
485 {
return !(__x == __y); }
491 #undef _GLIBCXX_STD_BASE
constexpr size_t size() const noexcept
Returns the total number of bits.
Struct holding two objects of arbitrary type.
A standard container composed of unique keys (containing at most one of each key value) in which the ...
Unordered_set wrapper with performance instrumentation.
The standard allocator, as per [20.4].
Unordered_multiset wrapper with performance instrumentation.
void swap(function< _Res(_Args...)> &__x, function< _Res(_Args...)> &__y)
Swap the targets of two polymorphic function object wrappers.
A standard container composed of equivalent keys (possibly containing multiple of each key value) in ...
One of the comparison functors.
Sequential helper functions. This file is a GNU profile extension to the Standard C++ Library...
Primary class template hash.