__GNU_PBDS::DETAIL::THIN_HEAP(3)

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

πŸ’– NAME πŸ’–

__gnu_pbds::detail::thin_heap< Value_Type, Cmp_Fn, _Alloc >

okay bestie so this is a page straight out of the Library Functions Manual and it's all about a lil class called a thin heap ✨ she's a detail-namespace girlie, she's templated, and she's here to be a priority-queue situation for you. no cap.


🌸 SYNOPSIS 🌸

to even look at her you gotta pull in the header:

#include <thin_heap_.hpp>

and she doesn't stand alone β€” she inherits from:

__gnu_pbds::detail::left_child_next_sibling_heap< Value_Type, Cmp_Fn, _Alloc::size_type, _Alloc >

so everything the base class has? she has it too. it's giving nepo baby but make it data structures πŸ’…

πŸŽ€ Public Types πŸŽ€

the whole typdef family, all together, no one left out:

  • 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 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

every single one, periodt. ✨

πŸ¦‹ Public Member Functions πŸ¦‹

the public API, the main character roster:

  • iterator begin ()
  • void clear ()
  • bool empty () const
  • iterator end ()
  • void erase (point_iterator)
  • template<typename Pred> size_type erase_if (Pred)
  • Cmp_Fn & get_cmp_fn ()
  • void join (thin_heap< Value_Type, Cmp_Fn, _Alloc > &)
  • size_type max_size () const
  • void modify (point_iterator, const_reference)
  • void pop ()
  • point_iterator push (const_reference)
  • size_type size () const
  • template<typename Pred> void split (Pred, thin_heap< Value_Type, Cmp_Fn, _Alloc > &)
  • void swap (left_child_next_sibling_heap< Value_Type, Cmp_Fn, _Alloc::size_type, _Alloc > &)
  • const_reference top () const

look at that top (). look at that pop (). obsessed fr fr. πŸ”₯

πŸ’œ Protected Types πŸ’œ

the backstage crew, protected but still iconic:

  • typedef base_type::node node
  • typedef alloc_traits::allocator_type node_allocator
  • typedef base_type::node_const_pointer node_const_pointer
  • typedef _Alloc::size_type node_metadata
  • typedef base_type::node_pointer node_pointer
  • typedef std::pair< node_pointer, node_pointer > node_pointer_pair

🌈 Protected Member Functions 🌈

the internal machinery β€” not for you, bestie, this is her business:

  • thin_heap (const Cmp_Fn &)
  • thin_heap (const thin_heap< Value_Type, Cmp_Fn, _Alloc > &)
  • 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 (thin_heap< Value_Type, Cmp_Fn, _Alloc > &)
  • void swap_with_parent (node_pointer, node_pointer)
  • void to_linked_list ()
  • void value_swap (left_child_next_sibling_heap &)

🧚 Static Protected Member Functions 🧚

just the one, and she's static, and she's protected, and she's serving:

  • static node_pointer parent (node_pointer)

πŸ“ Protected Attributes πŸ“

the two little state girlies hiding under the hood:

  • node_pointer m_p_root
  • size_type m_size

πŸ‘‘ Detailed Description πŸ‘‘

template<typename Value_Type, typename Cmp_Fn, typename _Alloc>
    class __gnu_pbds::detail::thin_heap< Value_Type, Cmp_Fn, _Alloc >

"Thin heap."

lowkey the whole description is just that. "Thin heap." two words. she said what she said. πŸ’€

and then, the citation, the receipts, the academic slay:

See Tarjan and Kaplan.

like okayyyy referencing the actual papers, we love a girl who cites her sources πŸ“šβœ¨


✨ Author ✨

Generated automatically by Doxygen for libstdc++ from the source code.

so yeah, no human wrote this page β€” Doxygen did, on autopilot, for libstdc++, straight from the source. a bot said "here's the lore" and honestly? it ate. πŸ€–πŸ’…


and that's the whole page bestie!! go build your priority queue, push your nodes, pop your top, and remember: it's a thin heap, not a mid heap. πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ’…πŸ«Ά

this lil rewrite was brought to you by the libstdc++ manual β€” page __gnu_pbds...n, _Alloc >(3), Library Functions Manual β€” mwah, ily, bye! πŸŒˆβ­πŸ’œ

πŸ“¦ 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