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;
82 const hasher& __hf = hasher(),
83 const key_equal& __eql = key_equal(),
84 const allocator_type& __a = allocator_type())
85 :
_Base(__n, __hf, __eql, __a)
88 template<
typename _InputIterator>
91 const hasher& __hf = hasher(),
92 const key_equal& __eql = key_equal(),
93 const allocator_type& __a = allocator_type())
94 :
_Base(__f, __l, __n, __hf, __eql, __a)
111 const allocator_type& __a)
112 :
_Base(__uset._M_base(), __a)
116 const allocator_type& __a)
117 :
_Base(std::move(__uset._M_base()), __a)
122 const hasher& __hf = hasher(),
123 const key_equal& __eql = key_equal(),
124 const allocator_type& __a = allocator_type())
125 :
_Base(__l, __n, __hf, __eql, __a)
133 const allocator_type& __a)
137 template<
typename _InputIterator>
140 const allocator_type& __a)
141 :
unordered_set(__first, __last, __n, hasher(), key_equal(), __a)
144 template<
typename _InputIterator>
146 size_type __n,
const hasher& __hf,
147 const allocator_type& __a)
148 :
unordered_set(__first, __last, __n, __hf, key_equal(), __a)
153 const allocator_type& __a)
158 size_type __n,
const hasher& __hf,
159 const allocator_type& __a)
172 this->_M_profile_destruct();
174 this->_M_profile_construct();
180 noexcept( noexcept(__x._M_base().swap(__x)) )
189 this->_M_profile_destruct();
191 this->_M_profile_construct();
194 template<
typename... _Args>
196 emplace(_Args&&... __args)
198 size_type __old_size = _Base::bucket_count();
200 = _Base::emplace(std::forward<_Args>(__args)...);
201 this->_M_profile_resize(__old_size);
205 template<
typename... _Args>
207 emplace_hint(const_iterator __it, _Args&&... __args)
209 size_type __old_size = _Base::bucket_count();
211 = _Base::emplace_hint(__it, std::forward<_Args>(__args)...);
212 this->_M_profile_resize(__old_size);
219 size_type __old_size = _Base::bucket_count();
221 this->_M_profile_resize(__old_size);
225 insert(
const value_type& __obj)
227 size_type __old_size = _Base::bucket_count();
229 this->_M_profile_resize(__old_size);
234 insert(const_iterator __iter,
const value_type& __v)
236 size_type __old_size = _Base::bucket_count();
237 iterator __res = _Base::insert(__iter, __v);
238 this->_M_profile_resize(__old_size);
243 insert(value_type&& __obj)
245 size_type __old_size = _Base::bucket_count();
247 this->_M_profile_resize(__old_size);
252 insert(const_iterator __iter, value_type&& __v)
254 size_type __old_size = _Base::bucket_count();
255 iterator __res = _Base::insert(__iter, std::move(__v));
256 this->_M_profile_resize(__old_size);
260 template<
typename _InputIter>
262 insert(_InputIter __first, _InputIter __last)
264 size_type __old_size = _Base::bucket_count();
265 _Base::insert(__first, __last);
266 this->_M_profile_resize(__old_size);
270 rehash(size_type __n)
272 size_type __old_size = _Base::bucket_count();
274 this->_M_profile_resize(__old_size);
278 template<
typename _Key,
typename _Hash,
typename _Pred,
typename _Alloc>
282 noexcept(noexcept(__x.swap(__y)))
285 template<
typename _Key,
typename _Hash,
typename _Pred,
typename _Alloc>
289 {
return static_cast<const _GLIBCXX_STD_BASE&
>(__x) == __y; }
291 template<
typename _Key,
typename _Hash,
typename _Pred,
typename _Alloc>
293 operator!=(
const unordered_set<_Key, _Hash, _Pred, _Alloc>& __x,
294 const unordered_set<_Key, _Hash, _Pred, _Alloc>& __y)
295 {
return !(__x == __y); }
298 #undef _GLIBCXX_STD_BASE 299 #define _GLIBCXX_STD_BASE _GLIBCXX_STD_C::_GLIBCXX_BASE 300 #define _GLIBCXX_BASE unordered_multiset<_Value, _Hash, _Pred, _Alloc> 303 template<
typename _Value,
308 :
public _GLIBCXX_STD_BASE,
309 public _Unordered_profile<unordered_multiset<_Value,
310 _Hash, _Pred, _Alloc>,
313 typedef _GLIBCXX_STD_BASE
_Base;
316 _M_base() noexcept {
return *
this; }
319 _M_base()
const noexcept {
return *
this; }
322 typedef typename _Base::size_type size_type;
323 typedef typename _Base::hasher hasher;
324 typedef typename _Base::key_equal key_equal;
325 typedef typename _Base::allocator_type allocator_type;
326 typedef typename _Base::key_type key_type;
327 typedef typename _Base::value_type value_type;
328 typedef typename _Base::difference_type difference_type;
329 typedef typename _Base::reference reference;
330 typedef typename _Base::const_reference const_reference;
332 typedef typename _Base::iterator iterator;
333 typedef typename _Base::const_iterator const_iterator;
339 const hasher& __hf = hasher(),
340 const key_equal& __eql = key_equal(),
341 const allocator_type& __a = allocator_type())
342 :
_Base(__n, __hf, __eql, __a)
345 template<
typename _InputIterator>
348 const hasher& __hf = hasher(),
349 const key_equal& __eql = key_equal(),
350 const allocator_type& __a = allocator_type())
351 :
_Base(__f, __l, __n, __hf, __eql, __a)
368 const allocator_type& __a)
369 :
_Base(__umset._M_base(), __a)
373 const allocator_type& __a)
374 :
_Base(std::move(__umset._M_base()), __a)
379 const hasher& __hf = hasher(),
380 const key_equal& __eql = key_equal(),
381 const allocator_type& __a = allocator_type())
382 :
_Base(__l, __n, __hf, __eql, __a)
390 const allocator_type& __a)
394 template<
typename _InputIterator>
397 const allocator_type& __a)
401 template<
typename _InputIterator>
403 size_type __n,
const hasher& __hf,
404 const allocator_type& __a)
410 const allocator_type& __a)
415 size_type __n,
const hasher& __hf,
416 const allocator_type& __a)
429 this->_M_profile_destruct();
431 this->_M_profile_construct();
437 noexcept( noexcept(__x._M_base().swap(__x)) )
446 this->_M_profile_destruct();
448 this->_M_profile_construct();
451 template<
typename... _Args>
453 emplace(_Args&&... __args)
455 size_type __old_size = _Base::bucket_count();
456 iterator __res = _Base::emplace(std::forward<_Args>(__args)...);
457 this->_M_profile_resize(__old_size);
461 template<
typename... _Args>
463 emplace_hint(const_iterator __it, _Args&&... __args)
465 size_type __old_size = _Base::bucket_count();
467 = _Base::emplace_hint(__it, std::forward<_Args>(__args)...);
468 this->_M_profile_resize(__old_size);
475 size_type __old_size = _Base::bucket_count();
477 this->_M_profile_resize(__old_size);
481 insert(
const value_type& __obj)
483 size_type __old_size = _Base::bucket_count();
484 iterator __res = _Base::insert(__obj);
485 this->_M_profile_resize(__old_size);
490 insert(const_iterator __iter,
const value_type& __v)
492 size_type __old_size = _Base::bucket_count();
493 iterator __res = _Base::insert(__iter, __v);
494 this->_M_profile_resize(__old_size);
499 insert(value_type&& __obj)
501 size_type __old_size = _Base::bucket_count();
502 iterator __res = _Base::insert(std::move(__obj));
503 this->_M_profile_resize(__old_size);
508 insert(const_iterator __iter, value_type&& __v)
510 size_type __old_size = _Base::bucket_count();
511 iterator __res = _Base::insert(__iter, std::move(__v));
512 this->_M_profile_resize(__old_size);
516 template<
typename _InputIter>
518 insert(_InputIter __first, _InputIter __last)
520 size_type __old_size = _Base::bucket_count();
521 _Base::insert(__first, __last);
522 this->_M_profile_resize(__old_size);
526 rehash(size_type __n)
528 size_type __old_size = _Base::bucket_count();
530 this->_M_profile_resize(__old_size);
534 template<
typename _Value,
typename _Hash,
typename _Pred,
typename _Alloc>
538 noexcept(noexcept(__x.swap(__y)))
541 template<
typename _Value,
typename _Hash,
typename _Pred,
typename _Alloc>
545 {
return static_cast<const _GLIBCXX_STD_BASE&
>(__x) == __y; }
547 template<
typename _Value,
typename _Hash,
typename _Pred,
typename _Alloc>
549 operator!=(
const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
550 const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
551 {
return !(__x == __y); }
557 #undef _GLIBCXX_STD_BASE
Sequential helper functions. This file is a GNU profile extension to the Standard C++ Library...
ISO C++ entities toplevel namespace is std.
Unordered_multiset wrapper with performance instrumentation.
One of the comparison functors.
Unordered_set wrapper with performance instrumentation.
A standard container composed of equivalent keys (possibly containing multiple of each key value) in ...
Struct holding two objects of arbitrary type.
Primary class template hash.
The standard allocator, as per [20.4].
A standard container composed of unique keys (containing at most one of each key value) in which the ...