__GNU_PARALLEL::LOSERTREEBASE(3)

πŸ“¦ version 4.4.0, in nixpkgs unstable

πŸ’… bestie, welcome to the __gnu_para...serTreeBase(3) page πŸ’…

okay so this is the __gnu_para...serTreeBase(3) page from the Library Functions Manual, and we're talking about __gnu_parallel::LoserTreeBase β€” the guarded loser/tournament tree. yes, the name is a lot, but it's literally giving β€œsmallest element at the top” main character energy. πŸ’–

πŸŽ€ NAME πŸŽ€

__gnu_parallel::LoserTreeBase β€” Guarded loser/tournament tree. that's the official name line, and we're keeping it exactly. periodt.

✨ SYNOPSIS ✨

🌸 Classes 🌸

  • struct Loser β€” Internal representation of a LoserTree element. yes, that's the whole description, and it's doing its job. 🫢

🫢 Public Member Functions 🫢

  • int get_min_source ()
  • void insert_start (const T &key, int source, bool sup)
  • LoserTreeBase (unsigned int _k, Comparator _comp)
  • ~LoserTreeBase ()

these are the public member function signatures, no cap. πŸ’…

πŸ”’ Protected Attributes πŸ”’

  • unsigned int _M_log_k
  • Comparator comp
  • bool first_insert
  • unsigned int ik
  • unsigned int k
  • Loser * losers
  • unsigned int offset

all seven of these are protected, so bestie, respect the boundary. πŸ’–

πŸ’– Detailed Description πŸ’–

template<typename T, typename Comparator> class
    __gnu_parallel::LoserTreeBase< T, Comparator >

Guarded loser/tournament tree. The smallest element is at the top β€” yes, that's the whole point. πŸ‘‘

Guarding is done explicitly through one flag sup per element, and inf is not needed due to a better initialization routine. This is a well-performing variant. no cap. ✨

Parameters:

  • T β€” the element type
  • Comparator β€” the comparator to use, defaults to std::less<T>

Definition at line 57 of file losertree.h. yes, line 57, not line 5, not line 7. πŸ’€

πŸ’– Constructor & Destructor Documentation πŸ’–

🐣 LoserTreeBase constructor

template<typename T, typename Comparator> __gnu_parallel::LoserTreeBase< T,
    Comparator >::LoserTreeBase (unsigned int _k, Comparator _comp) [inline]

The constructor.

Parameters:

  • _k β€” The number of sequences to merge.
  • _comp β€” The comparator to use.

Definition at line 96 of file losertree.h.

🫧 ~LoserTreeBase destructor

template<typename T, typename Comparator> __gnu_parallel::LoserTreeBase< T,
    Comparator >::~LoserTreeBase () [inline]

The destructor.

Definition at line 119 of file losertree.h.

πŸ”₯ Member Function Documentation πŸ”₯

🌟 get_min_source

template<typename T, typename Comparator> int __gnu_parallel::LoserTreeBase<
    T, Comparator >::get_min_source () [inline]

Returns:

  • the index of the sequence with the smallest element.

Definition at line 152 of file losertree.h.

🌟 insert_start

template<typename T, typename Comparator> void
    __gnu_parallel::LoserTreeBase< T, Comparator >::insert_start (const T &
    key, int source, bool sup) [inline]

Initializes the sequence 'source' with the element 'key'. yes, those quotes are doing the lord's work. πŸ™ˆ

Parameters:

  • key β€” the element to insert
  • source β€” index of the source sequence
  • sup β€” flag that determines whether the value to insert is an explicit supremum.

Definition at line 131 of file losertree.h.

🌈 Member Data Documentation 🌈

  • unsigned int _M_log_k [protected] β€” log_2{k}. Definition at line 74 of file losertree.h. Referenced by __gnu_parallel::LoserTreeBase< T, Comparator >::LoserTreeBase().
  • Comparator comp [protected] β€” Comparator to use. Definition at line 80 of file losertree.h.
  • bool first_insert [protected] β€” State flag that determines whether the LoserTree is empty. Only used for building the LoserTree. Definition at line 87 of file losertree.h. Referenced by __gnu_parallel::LoserTreeBase< T, Comparator >::insert_start(), and __gnu_parallel::LoserTreeBase< T, Comparator >::LoserTreeBase().
  • Loser* losers [protected] β€” LoserTree elements. Definition at line 77 of file losertree.h. Referenced by __gnu_parallel::LoserTreeBase< T, Comparator >::get_min_source(), __gnu_parallel::LoserTreeBase< T, Comparator >::insert_start(), __gnu_parallel::LoserTreeBase< T, Comparator >::LoserTreeBase(), and __gnu_parallel::LoserTreeBase< T, Comparator >::~LoserTreeBase().

also chilling in the protected attributes list from the synopsis: unsigned int ik, unsigned int k, and unsigned int offset. the original page doesn't give these three their own member-data blurbs, so we're not inventing any. 🫢

πŸ’Œ Author πŸ’Œ

Generated automatically by Doxygen for libstdc++ from the source code. yes, bestie, the author is Doxygen. a bot wrote it and still ate. πŸ’…


okay bestie, that's the whole page. source/version: libstdc++; date: 21 Apr 2009; footer title: __gnu_para...serTreeBase(3). go merge those sequences and slay. πŸ’‹βœ¨

πŸ“¦ where this page comes from