__GNU_PBDS::PRIORITY_QUEUE(3)

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

🌸 NAME 🌸

__gnu_pbds::priority_queue< _Tv, Cmp_Fn, Tag, _Alloc > β€” bestie, it's a priority queue, but make it policy-based πŸ’…

This page lives in the Library Functions Manual, section 3, and it's all about the libstdc++ <priority_queue.hpp> glow-up. Periodt.


✨ SYNOPSIS ✨

#include <priority_queue.hpp>

πŸŽ€ Public Types πŸŽ€

Okay so here's the whole type roster, no skips, all of them:

  • typedef _Alloc allocator_type β€” the allocator, but with a cuter name
  • typedef Cmp_Fn cmp_fn β€” your comparison functor's alias era
  • typedef base_type::const_iterator const_iterator β€” read-only iterator, main character but can't touch anything
  • typedef __rebind_va::const_pointer const_pointer β€” const pointer, iconic
  • typedef __rebind_va::const_reference const_reference β€” const reference, obsessed
  • typedef Tag container_category β€” the Tag telling everyone which heap vibe this container is on
  • typedef allocator_type::difference_type difference_type β€” difference type, for when you need to know how far
  • typedef base_type::iterator iterator β€” the regular iterator, it can touch things
  • typedef base_type::point_const_iterator point_const_iterator β€” const point iterator, iykyk
  • typedef base_type::point_iterator point_iterator β€” point iterator, the one that points at your element fr fr
  • typedef __rebind_va::pointer pointer β€” pointer πŸ’–
  • typedef __rebind_va::reference reference β€” reference πŸ’–
  • typedef allocator_type::size_type size_type β€” size type, for all your counting needs
  • typedef _Tv value_type β€” the actual value type, the moment

πŸ¦‹ Public Member Functions πŸ¦‹

  • priority_queue (const cmp_fn &r_cmp_fn) β€” constructor that takes some policy objects. r_cmp_fn gets copied by the Cmp_Fn object of the container object. Not a drill.
  • priority_queue (const priority_queue &other) β€” copy constructor, doing a little duplicate
  • template<typename It> priority_queue (It first_it, It last_it) β€” constructor taking __iterators to a range of value_types. The value_types between first_it and last_it get inserted into the container object. Slay.
  • template<typename It> priority_queue (It first_it, It last_it, const cmp_fn &r_cmp_fn) β€” constructor taking __iterators to a range of value_types and some policy objects. The value_types between first_it and last_it get inserted into the container object, and r_cmp_fn gets copied by the cmp_fn object of the container object.
  • priority_queue & operator= (const priority_queue &other) β€” assignment operator, passing the vibe along
  • void swap (priority_queue &other) β€” swap, the classic two-way trade 🀝

πŸ’œ Detailed Description πŸ’œ

template<typename _Tv, typename Cmp_Fn = std::less<_Tv>, typename Tag =
    pairing_heap_tag, typename _Alloc = std::allocator<char>>
class __gnu_pbds::priority_queue< _Tv, Cmp_Fn, Tag, _Alloc >

"A priority queue composed of one specific heap policy." That's the whole premise bestie, one queue, one heap policy, committed relationship energy.

🌈 Template Parameters 🌈

  • _Tv β€” value type. The thing you're storing.
  • Cmp_Fn β€” comparison functor. It decides who's actually more important.
  • Tag β€” instantiating data structure type, see container_tag. This is the vibe selector.
  • _Alloc β€” allocator type.

Base is dispatched at compile time via Tag, from the following choices: binary_heap_tag, binomial_heap_tag, pairing_heap_tag, rc_binomial_heap_tag, thin_heap_tag

Base choices are: detail::binary_heap, detail::binomial_heap, detail::pairing_heap, detail::rc_binomial_heap, detail::thin_heap.


🫢 Constructor & Destructor Documentation 🫢

priority_queue (const cmp_fn &r_cmp_fn) β€” constructor #1

template<typename _Tv, typename Cmp_Fn = std::less<_Tv>, typename Tag =
    pairing_heap_tag, typename _Alloc = std::allocator<char>>
__gnu_pbds::priority_queue< _Tv, Cmp_Fn, Tag, _Alloc >::priority_queue
(const cmp_fn & r_cmp_fn) [inline]

Constructor taking some policy objects. r_cmp_fn will be copied by the Cmp_Fn object of the container object. ✨

priority_queue (It first_it, It last_it) β€” constructor #2

template<typename _Tv, typename Cmp_Fn = std::less<_Tv>, typename Tag =
    pairing_heap_tag, typename _Alloc = std::allocator<char>>
template<typename It> __gnu_pbds::priority_queue< _Tv, Cmp_Fn, Tag,
_Alloc >::priority_queue (It first_it, It last_it) [inline]

Constructor taking __iterators to a range of value_types. The value_types between first_it and last_it will be inserted into the container object. πŸŽ€

priority_queue (It first_it, It last_it, const cmp_fn &r_cmp_fn) β€” constructor #3

template<typename _Tv, typename Cmp_Fn = std::less<_Tv>, typename Tag =
    pairing_heap_tag, typename _Alloc = std::allocator<char>>
template<typename It> __gnu_pbds::priority_queue< _Tv, Cmp_Fn, Tag,
_Alloc >::priority_queue (It first_it, It last_it, const cmp_fn &
r_cmp_fn) [inline]

Constructor taking __iterators to a range of value_types and some policy objects. The value_types between first_it and last_it will be inserted into the container object. r_cmp_fn will be copied by the cmp_fn object of the container object. Two-for-one, we love to see it. πŸ’…

Heads up bestie: the description literally reads "and some policy objects The value_types..." β€” no period in the original, so no period from me. Fidelity is the moment.

πŸ‘‘ Author πŸ‘‘

Generated automatically by Doxygen for libstdc++ from the source code. Not a human, just a very dedicated documentation robot doing its thing. πŸ€–


Okay that's the whole page, and as a lil sign-off: this came from libstdc++, it's filed under __gnu_pbds..., _Alloc >(3) in the Library Functions Manual, and there's no date on it so we're just gonna say timeless 🌟 mwah, go forth and heapify πŸ’–

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