libstdc++
__gnu_parallel::_LoserTreeBase< _Tp, _Compare > Class Template Reference
Inheritance diagram for __gnu_parallel::_LoserTreeBase< _Tp, _Compare >:
[legend]

Classes

struct  _Loser
 

Public Member Functions

 _LoserTreeBase (unsigned int __k, _Compare __comp)
 
 ~_LoserTreeBase ()
 
int __get_min_source ()
 
void __insert_start (const _Tp &__key, int __source, bool __sup)
 

Protected Attributes

_Compare _M_comp
 
bool _M_first_insert
 
unsigned int _M_ik
 
unsigned int _M_k
 
unsigned int _M_log_k
 
_Loser_M_losers
 
unsigned int _M_offset
 

Detailed Description

template<typename _Tp, typename _Compare>
class __gnu_parallel::_LoserTreeBase< _Tp, _Compare >

Guarded loser/tournament tree.

The smallest element is at the top.

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

Parameters
_Tpthe element type
_Comparethe comparator to use, defaults to std::less<_Tp>

Definition at line 55 of file losertree.h.

Constructor & Destructor Documentation

◆ _LoserTreeBase()

template<typename _Tp , typename _Compare >
__gnu_parallel::_LoserTreeBase< _Tp, _Compare >::_LoserTreeBase ( unsigned int  __k,
_Compare  __comp 
)
inline

The constructor.

Parameters
__kThe number of sequences to merge.
__compThe comparator to use.

Definition at line 94 of file losertree.h.

References __gnu_parallel::__rd_log2(), __gnu_parallel::_LoserTreeBase< _Tp, _Compare >::_M_first_insert, __gnu_parallel::_LoserTreeBase< _Tp, _Compare >::_M_log_k, and __gnu_parallel::_LoserTreeBase< _Tp, _Compare >::_M_losers.

◆ ~_LoserTreeBase()

template<typename _Tp , typename _Compare >
__gnu_parallel::_LoserTreeBase< _Tp, _Compare >::~_LoserTreeBase ( )
inline

The destructor.

Definition at line 118 of file losertree.h.

References __gnu_parallel::_LoserTreeBase< _Tp, _Compare >::_M_losers.

Member Function Documentation

◆ __get_min_source()

template<typename _Tp , typename _Compare >
int __gnu_parallel::_LoserTreeBase< _Tp, _Compare >::__get_min_source ( )
inline
Returns
the index of the sequence with the smallest element.

Definition at line 155 of file losertree.h.

References __gnu_parallel::_LoserTreeBase< _Tp, _Compare >::_M_losers, and __gnu_parallel::_LoserTreeBase< _Tp, _Compare >::_Loser::_M_source.

◆ __insert_start()

template<typename _Tp , typename _Compare >
void __gnu_parallel::_LoserTreeBase< _Tp, _Compare >::__insert_start ( const _Tp &  __key,
int  __source,
bool  __sup 
)
inline

Initializes the sequence "_M_source" with the element "__key".

Parameters
__keythe element to insert
__source__index of the __source __sequence
__supflag that determines whether the value to insert is an explicit __supremum.

Definition at line 134 of file losertree.h.

References __gnu_parallel::_LoserTreeBase< _Tp, _Compare >::_M_first_insert, __gnu_parallel::_LoserTreeBase< _Tp, _Compare >::_Loser::_M_key, __gnu_parallel::_LoserTreeBase< _Tp, _Compare >::_M_losers, __gnu_parallel::_LoserTreeBase< _Tp, _Compare >::_Loser::_M_source, and __gnu_parallel::_LoserTreeBase< _Tp, _Compare >::_Loser::_M_sup.

Member Data Documentation

◆ _M_comp

template<typename _Tp , typename _Compare >
_Compare __gnu_parallel::_LoserTreeBase< _Tp, _Compare >::_M_comp
protected

_Compare to use.

Definition at line 78 of file losertree.h.

◆ _M_first_insert

template<typename _Tp , typename _Compare >
bool __gnu_parallel::_LoserTreeBase< _Tp, _Compare >::_M_first_insert
protected

State flag that determines whether the _LoserTree is empty.

Only used for building the _LoserTree.

Definition at line 85 of file losertree.h.

Referenced by __gnu_parallel::_LoserTreeBase< _Tp, _Compare >::__insert_start(), and __gnu_parallel::_LoserTreeBase< _Tp, _Compare >::_LoserTreeBase().

◆ _M_log_k

template<typename _Tp , typename _Compare >
unsigned int __gnu_parallel::_LoserTreeBase< _Tp, _Compare >::_M_log_k
protected

log_2{_M_k}

Definition at line 72 of file losertree.h.

Referenced by __gnu_parallel::_LoserTreeBase< _Tp, _Compare >::_LoserTreeBase().

◆ _M_losers


The documentation for this class was generated from the following file: