__GNU_PBDS::DETAIL::THIN_HEAP(3)
π 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_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 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
every single one, periodt. β¨
π¦ Public Member Functions π¦
the public API, the main character roster:
iterator begin ()void clear ()bool empty () constiterator 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 () constvoid modify (point_iterator, const_reference)void pop ()point_iterator push (const_reference)size_type size () consttemplate<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 nodetypedef alloc_traits::allocator_type node_allocatortypedef base_type::node_const_pointer node_const_pointertypedef _Alloc::size_type node_metadatatypedef base_type::node_pointer node_pointertypedef 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_rootsize_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