__GNU_PBDS::PRIORITY_QUEUE(3cxx)

πŸ’– NAME πŸ’–

__gnu_pbds::priority_queue< _Tv, Cmp_Fn, Tag, _Alloc > β€” bestie, this is the libstdc++ (section 3cxx) priority queue that lets you pick which heap policy it runs on. Main character container energy fr fr πŸ‘‘


✨ SYNOPSIS ✨

#include <priority_queue.hpp>

Lowkey important: it inherits detail::container_base_dispatch::type. That's the whole inheritance situation, no cap 🫢

🌸 Public Types 🌸

  • typedef _Alloc allocator_type
  • typedef Cmp_Fn cmp_fn
  • typedef base_type::const_iterator const_iterator
  • typedef __rebind_va::const_pointer const_pointer
  • typedef __rebind_va::const_reference const_reference
  • typedef Tag container_category
  • typedef allocator_type::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_va::pointer pointer
  • typedef __rebind_va::reference reference
  • typedef allocator_type::size_type size_type
  • typedef _Tv value_type

That's fourteen typedefs and yes, we're listing every single one, because the details are the moment πŸ’…

πŸŽ€ Public Member Functions πŸŽ€

  • priority_queue (const cmp_fn &r_cmp_fn) β€” constructor that takes your policy objects. r_cmp_fn gets copied by the Cmp_Fn object of the container object. 🧚
  • priority_queue (const priority_queue &other) β€” the copy constructor, doing copy-constructor things, iconic behaviour only.
  • template<typename It > priority_queue (It first_it, It last_it) β€” constructor that takes iterators to a range of value_types. Everything between first_it and last_it gets inserted into the container object. πŸ¦‹
  • template<typename It > priority_queue (It first_it, It last_it, const cmp_fn &r_cmp_fn) β€” same iterator-range deal plus 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, slay.
  • void swap (priority_queue &other) β€” swaps with other. That's the whole vibe check. πŸ”₯

πŸ’œ 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 >

It's giving "a priority queue composed of one specific heap policy." Like, literally exactly that. 🌈

Template Parameters

  • _Tv β€” value type.
  • Cmp_Fn β€” comparison functor.
  • Tag β€” instantiating data structure type, see container_tag.
  • _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. Pick your fighter πŸ˜­πŸ‘‘


🧚 Constructor & Destructor Documentation 🧚

priority_queue (const cmp_fn & r_cmp_fn) β€” inline

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. Obsessed with this for us πŸ’–

priority_queue (It first_it, It last_it) β€” inline

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. Range-based and flawless 🌸

priority_queue (It first_it, It last_it, const cmp_fn & r_cmp_fn) β€” inline

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. Both at once? Ate. ✨


πŸ‘‘ Author πŸ‘‘

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


Ok that's the whole page bestie, nothing skipped, we ate and left no crumbs πŸ“πŸ’…

Sign-off time: this gorgeous little page comes from libstdc++, generated automatically by Doxygen straight from the source code, and it lives in manual section 3cxx β€” the __gnu_pbds::priority_queue< _Tv, Cmp_Fn, Tag, _Alloc > page. Go build something iconic with it πŸ’–πŸŽ€πŸ¦‹