__GNU_PBDS::DETAIL::PAIRING_HEAP(3)

πŸ“¦
version 16.2.1+r23+gd564253eb6c8 Β· 7 versions
, in arch rolling, fedora 44

✨ 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_type
  • typedef Cmp_Fn cmp_fn
  • typedef base_type::const_iterator const_iterator
  • typedef __rebind_a::const_pointer const_pointer
  • typedef __rebind_a::const_reference const_reference
  • typedef _Alloc::difference_type difference_type
  • typedef base_type::iterator iterator
  • typedef left_child_next_sibling_heap_node_< Value_Type, null_type, _Alloc > node
  • typedef base_type::point_const_iterator point_const_iterator
  • typedef base_type::point_iterator point_iterator
  • typedef __rebind_a::pointer pointer
  • typedef __rebind_a::reference reference
  • typedef _Alloc::size_type size_type
  • typedef 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 with
  • pairing_heap (const pairing_heap &) β€” the copy constructor, twin energy
  • iterator begin () β€” iterator to the beginning, non-const flavour
  • const_iterator begin () const β€” same, but const, she's being careful
  • void clear () β€” wipe it, nothing left
  • bool empty () const β€” the vibe check: is she empty or not
  • iterator end () β€” iterator to the end, non-const
  • const_iterator end () const β€” end again, const edition
  • void erase (point_iterator) β€” yeet the thing at that point iterator
  • template<typename Pred> size_type erase_if (Pred) β€” erase whatever your predicate says yes to
  • Cmp_Fn & get_cmp_fn () β€” hand back the comparator
  • const Cmp_Fn & get_cmp_fn () const β€” same comparator, const mode
  • void join (pairing_heap &) β€” merge another pairing heap in, it's giving teamwork
  • size_type max_size () const β€” the absolute most she can hold
  • void modify (point_iterator, const_reference) β€” change up the value sitting at that point iterator
  • void pop () β€” drop the top
  • point_iterator push (const_reference) β€” shove a new value in, get a point iterator back
  • size_type size () const β€” how many are in there rn
  • template<typename Pred> void split (Pred, pairing_heap &) β€” split off whatever the predicate picks out into another pairing heap
  • void swap (left_child_next_sibling_heap< Value_Type, Cmp_Fn, null_type, _Alloc > &) β€” trade contents with the base heap
  • void swap (pairing_heap &) β€” trade contents with another pairing heap
  • const_reference top () const β€” peep the top without touching it

πŸ”’ Protected Types

for the inner circle only:

  • typedef alloc_traits::allocator_type node_allocator
  • typedef alloc_traits::const_pointer node_const_pointer
  • typedef null_type node_metadata
  • typedef 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_root
  • size_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