__GNU_PBDS::DETAIL::PAIRING_HEAP(3)
β¨ NAME β¨
__gnu_pbds::detail::pairing_heap< Value_Type, Cmp_Fn, _Alloc > β bestie, this is a pairing heap, and it lives in the libstdc++ Library Functions Manual. That's the whole name, no cap. π
π¦ SYNOPSIS π¦
okay so first thing, you gotta pull it in like this:
#include <pairing_heap_.hpp>
and it does NOT stand on its own two feet, it's a nepo baby β it inherits from this:
Inherits __gnu_pbds::detail::left_child_next_sibling_heap< Value_Type,
Cmp_Fn, null_type, _Alloc >.
π Public Types
the whole little family of type aliases it brings to the group chat:
typedef _Alloc allocator_typetypedef Cmp_Fn cmp_fntypedef base_type::const_iterator const_iteratortypedef __rebind_a::const_pointer const_pointertypedef __rebind_a::const_reference const_referencetypedef _Alloc::difference_type difference_typetypedef base_type::iterator iteratortypedef left_child_next_sibling_heap_node_< Value_Type, null_type, _Alloc > nodetypedef base_type::point_const_iterator point_const_iteratortypedef base_type::point_iterator point_iteratortypedef __rebind_a::pointer pointertypedef __rebind_a::reference referencetypedef _Alloc::size_type size_typetypedef Value_Type value_type
πΈ Public Member Functions
everything you can actually do with her, she's so versatile:
pairing_heap (const Cmp_Fn &)β build one, hand her a comparator to vibe withpairing_heap (const pairing_heap &)β the copy constructor, twin energyiterator begin ()β iterator to the beginning, non-const flavourconst_iterator begin () constβ same, but const, she's being carefulvoid clear ()β wipe it, nothing leftbool empty () constβ the vibe check: is she empty or notiterator end ()β iterator to the end, non-constconst_iterator end () constβ end again, const editionvoid erase (point_iterator)β yeet the thing at that point iteratortemplate<typename Pred> size_type erase_if (Pred)β erase whatever your predicate says yes toCmp_Fn & get_cmp_fn ()β hand back the comparatorconst Cmp_Fn & get_cmp_fn () constβ same comparator, const modevoid join (pairing_heap &)β merge another pairing heap in, it's giving teamworksize_type max_size () constβ the absolute most she can holdvoid modify (point_iterator, const_reference)β change up the value sitting at that point iteratorvoid pop ()β drop the toppoint_iterator push (const_reference)β shove a new value in, get a point iterator backsize_type size () constβ how many are in there rntemplate<typename Pred> void split (Pred, pairing_heap &)β split off whatever the predicate picks out into another pairing heapvoid swap (left_child_next_sibling_heap< Value_Type, Cmp_Fn, null_type, _Alloc > &)β trade contents with the base heapvoid swap (pairing_heap &)β trade contents with another pairing heapconst_reference top () constβ peep the top without touching it
π Protected Types
for the inner circle only:
typedef alloc_traits::allocator_type node_allocatortypedef alloc_traits::const_pointer node_const_pointertypedef null_type node_metadatatypedef std::pair< node_pointer, node_pointer > node_pointer_pair
π Protected Member Functions
the behind-the-scenes girlies, not for public consumption:
void actual_erase_node (node_pointer)void bubble_to_top (node_pointer)void clear_imp (node_pointer)template<typename It> void copy_from_range (It, It)node_pointer get_new_node_for_insert (const_reference)node_pointer prune (Pred)void swap_with_parent (node_pointer, node_pointer)void to_linked_list ()void value_swap (left_child_next_sibling_heap &)
π Static Protected Member Functions
these ones don't even need an object, they just are:
static void make_child_of (node_pointer, node_pointer)static node_pointer parent (node_pointer)
π Protected Attributes
the internals, the lore, the state:
node_pointer m_p_rootsize_type m_size
π Detailed Description π
so, template time, say it with me:
template<typename Value_Type, typename Cmp_Fn, typename _Alloc>
class __gnu_pbds::detail::pairing_heap< Value_Type, Cmp_Fn, _Alloc >
and what is she, in four little words? "Pairing heap." π that's it, that's the description, slay.
π Author π
Generated automatically by Doxygen for libstdc++ from the source code. she wasn't hand-written by a human and honestly? iconic behaviour. π
and that's a wrap bestie π«Ά this page came to you courtesy of libstdc++, from the Library Functions Manual β go forth and heap responsibly β¨ππ¦
π¦ 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.0.1-0.10.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
- 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