STD::__DEBUG::UNORDERED_SET(3)
β¨ NAME β¨
okay so bestie, meet std::__debug::unordered_set< _Value, _Hash, _Pred, _Alloc > β it's a Class std::unordered_set with safety/checking/debug instrumentation. yes literally the same set you know and love but wearing a hi-vis vest π
this is a Library Functions Manual page from libstdc++, so buckle up π
πΈ SYNOPSIS πΈ
#include <unordered_set>
Inherits __gnu_debug::_Safe_container< _SafeContainer, _Alloc, _SafeBase, _IsCxx11AllocatorAware >. yes it's got a whole family tree, main character energy fr fr π
π Public Types
typedef _Base::allocator_type allocator_typeβ the allocator type, straight from_Basetypedef __gnu_debug::_Safe_iterator< _Base_const_iterator, unordered_set > const_iteratorβ const iterator, but make it safe (it's a_Safe_iteratorbestie)typedef __gnu_debug::_Safe_local_iterator< _Base_const_local_iterator, unordered_set > const_local_iteratorβ const local iterator, also safety-instrumented,_Safe_local_iteratorcodedtypedef _Base::const_pointer const_pointerβ const pointer, from_Basetypedef _Base::const_reference const_referenceβ const reference, from_Basetypedef _Base::difference_type difference_typeβ difference type, from_Basetypedef _Base::hasher hasherβ the hasher typetypedef __gnu_debug::_Safe_iterator< _Base_iterator, unordered_set > iteratorβ the iterator, and yes it's a_Safe_iteratorso it's checking on you πtypedef _Base::key_equal key_equalβ key equality predicate typetypedef _Base::key_type key_typeβ key typetypedef __gnu_debug::_Safe_local_iterator< _Base_local_iterator, unordered_set > local_iteratorβ local iterator,_Safe_local_iteratorflavoredtypedef _Base::pointer pointerβ pointertypedef _Base::reference referenceβ referencetypedef _Base::size_type size_typeβ size typetypedef _Base::value_type value_typeβ value type
π¦ Public Member Functions
the constructor lineup is honestly giving runway show, there's one for every occasion:
unordered_set (_Base_ref __x)β builds from a_Base_reftemplate<typename _InputIterator> unordered_set (_InputIterator __first, _InputIterator __last, const allocator_type &__a)β range + allocatortemplate<typename _InputIterator> unordered_set (_InputIterator __first, _InputIterator __last, size_type __n, const allocator_type &__a)β range + bucket count + allocatortemplate<typename _InputIterator> unordered_set (_InputIterator __first, _InputIterator __last, size_type __n, const hasher &__hf, const allocator_type &__a)β range + bucket count + hasher + allocatortemplate<typename _InputIterator> unordered_set (_InputIterator __first, _InputIterator __last, size_type __n=0, const hasher &__hf=hasher(), const key_equal &__eql=key_equal(), const allocator_type &__a=allocator_type())β the full range version, all defaults baked inunordered_set (const allocator_type &__a)β just an allocatorunordered_set (const unordered_set &)=defaultβ copy ctor, defaulted, iconicunordered_set (const unordered_set &__uset, const allocator_type &__a)β copy + allocatorunordered_set (initializer_list< value_type > __l, const allocator_type &__a)β init list + allocatorunordered_set (initializer_list< value_type > __l, size_type __n, const allocator_type &__a)β init list + bucket count + allocatorunordered_set (initializer_list< value_type > __l, size_type __n, const hasher &__hf, const allocator_type &__a)β init list + bucket count + hasher + allocatorunordered_set (initializer_list< value_type > __l, size_type __n=0, const hasher &__hf=hasher(), const key_equal &__eql=key_equal(), const allocator_type &__a=allocator_type())β init list, everything defaultedunordered_set (size_type __n, const allocator_type &__a)β bucket count + allocatorunordered_set (size_type __n, const hasher &__hf, const allocator_type &__a)β bucket count + hasher + allocatorunordered_set (size_type __n, const hasher &__hf=hasher(), const key_equal &__eql=key_equal(), const allocator_type &__a=allocator_type())β bucket count with the full default squadunordered_set (unordered_set &&)=defaultβ move ctor, defaulted, we love a clean handoff πunordered_set (unordered_set &&__uset, const allocator_type &__a) noexcept(noexcept(_Base(std::move(__uset), __a)))β move + allocator, with that exactnoexceptspec, no cap
then the actual moves:
const _Base & _M_base () const noexceptβ grab the const_Baseunderneath,noexcept_Base & _M_base () noexceptβ grab the non-const_Base, alsonoexceptconst_iterator begin () const noexceptβ start of the const iterator runiterator begin () noexceptβ start of the iterator runlocal_iterator begin (size_type __b)β start of bucket__bconst_local_iterator begin (size_type __b) constβ const start of bucket__bsize_type bucket_size (size_type __b) constβ how many things are chilling in bucket__bconst_iterator cbegin () const noexceptβ const begin,noexceptconst_local_iterator cbegin (size_type __b) constβ const start of bucket__bconst_iterator cend () const noexceptβ const end,noexceptconst_local_iterator cend (size_type __b) constβ const end of bucket__bvoid clear () noexceptβ wipe it,noexcepttemplate<typename... _Args> std::pair< iterator, bool > emplace (_Args &&... __args)β construct in place, hands back theiteratorplus abooltemplate<typename... _Args> iterator emplace_hint (const_iterator __hint, _Args &&... __args)β in-place construct with a hint, returns aniteratorconst_iterator end () const noexceptβ end of the const run,noexceptiterator end () noexceptβ end of the run,noexceptlocal_iterator end (size_type __b)β end of bucket__bconst_local_iterator end (size_type __b) constβ const end of bucket__bstd::pair< iterator, iterator > equal_range (const key_type &__key)β the range matching__keystd::pair< const_iterator, const_iterator > equal_range (const key_type &__key) constβ const version of the same_Base_iterator erase (_Base_const_iterator __it)β erase by_Base_const_iterator, returns a_Base_iteratortemplate<__heterogeneous_hash_key< unordered_set > _Kt> size_type erase (_Kt &&__key)β heterogeneous erase, gives you asize_typesize_type erase (const key_type &__key)β erase by key, gives you asize_typeiterator erase (const_iterator __first, const_iterator __last)β erase a whole[__first, __last)rangeiterator erase (const_iterator __it)β erase one const iteratoriterator erase (iterator __it)β erase one iteratoriterator find (const key_type &__key)β go find__keyconst_iterator find (const key_type &__key) constβ const findtemplate<typename _InputIterator> void insert (_InputIterator __first, _InputIterator __last)β insert a range, returnsvoidtemplate<__heterogeneous_hash_key< unordered_set > _Kt> std::pair< iterator, bool > insert (_Kt &&__obj)β heterogeneous insert βstd::pair< iterator, bool >std::pair< iterator, bool > insert (const value_type &__obj)β insert a const value βstd::pair< iterator, bool >template<__heterogeneous_hash_key< unordered_set > _Kt> iterator insert (const_iterator __hint, _Kt &&__obj)β heterogeneous insert with a hintiterator insert (const_iterator __hint, const value_type &__obj)β insert with a hint, const valueiterator insert (const_iterator __hint, value_type &&__obj)β insert with a hint, rvalue valuevoid insert (std::initializer_list< value_type > __l)β dump a whole init list in, returnsvoidstd::pair< iterator, bool > insert (value_type &&__obj)β insert an rvalue βstd::pair< iterator, bool >float max_load_factor () const noexceptβ read the max load factor, afloat,noexceptvoid max_load_factor (float __f)β set the max load factor to__funordered_set & operator= (const unordered_set &)=defaultβ copy assign, defaultedunordered_set & operator= (initializer_list< value_type > __l)β assign from an init listunordered_set & operator= (unordered_set &&)=defaultβ move assign, defaultedvoid swap (unordered_set &__x) noexcept(noexcept(declval< _Base & >().swap(__x)))β swap with__x, with that exactnoexceptspec
π Protected Member Functions
constexpr void _M_swap (const _Safe_container &__x) const noexceptβ the internal swap,constexpr, const,noexcept, protected. she's shy but powerful π
π«Ά Friends
template<typename _ItT, typename _SeqT, typename _CatT> class ::__gnu_debug::_Safe_iteratorβ friend classtemplate<typename _ItT, typename _SeqT> class ::__gnu_debug::_Safe_local_iteratorβ friend class
π Detailed Description π
the full tea, template signature and all:
template<typename _Value, typename _Hash = std::hash<_Value>, typename _Pred
= std::equal_to<_Value>, typename _Alloc = std::allocator<_Value>>
class std::__debug::unordered_set< _Value, _Hash, _Pred, _Alloc >
and the class describes itself as:
"Class std::unordered_set with safety/checking/debug instrumentation.
so yeah β same unordered_set, extra checking, extra safety, extra debug. it's the version that actually notices when you do something unhinged π
π Author
Generated automatically by Doxygen for libstdc++ from the source code. (not a human author bestie, it's a robot that read the source so you don't have to π€β¨)
and that's the whole page!! this came from libstdc++, manual page for std::__debug::unordered_set< _Value, _Hash, _Pred, _Alloc > in section 3, and it's the debug/safety-instrumented one β so if you're out here with unchecked iterators, that's giving undefined behaviour and this class is literally the vibe check for that π slay responsibly, periodt ππ
π¦ where this page comes from
- arch rolling: gcc 16.2.1+r23+gd564253eb6c8-1 Β· GPL-3.0-or-later WITH GCC-exception-3.1 AND GFDL-1.3-or-later
- fedora 44: libstdc++-docs 16.2.1-2.fc44
- fedora 44: libstdc++-docs 16.2.1-3.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms