---
name: "__gnu_parallel::LoserTree"
section: "3cxx"
platform: "linux"
package: "libstdc++6-4.4-doc"
version: "4.4.7-2"
release: "Debian 7 (Wheezy)"
platforms: ["linux"]
url: "https://new.carta.tech/__gnu_parallel::LoserTree/3cxx"
---

# \_\_gnu\_parallel::LoserTree(3cxx)

## NAME

\_\_gnu\_parallel::LoserTree\< stable, T, Comparator \> -

## SYNOPSIS

Inherits **\_\_gnu\_parallel::LoserTreeBase\< T, Comparator \>**.

### Public Member Functions

void **delete\_min\_insert** (T key, bool sup)\
 int **get\_min\_source** ()\
 void **init** ()\
 unsigned int **init\_winner** (unsigned int root)\
 void **insert\_start** (const T &key, int source, bool sup)\
 **LoserTree** (unsigned int \_k, Comparator \_comp)\

### Protected Attributes

unsigned int **\_M\_log\_k**\
 Comparator **comp**\
 bool **first\_insert**\
 unsigned int **ik**\
 unsigned int **k**\
 **Loser** \* **losers**\
 unsigned int **offset**\

## Detailed Description

### template\<bool stable, typename T, typename Comparator\>class \_\_gnu\_parallel::LoserTree\< stable, T, Comparator \>

Stable **LoserTree** variant.

Provides the stable implementations of insert\_start, init\_winner, init and delete\_min\_insert.

Unstable variant is done using partial specialisation below.

Definition at line 165 of file losertree.h.

## Member Function Documentation

### template\<bool stable, typename T , typename Comparator \> void \_\_gnu\_parallel::LoserTree\< stable, T, Comparator \>::delete\_min\_insert (Tkey, boolsup)` [inline]`

Delete the smallest element and insert a new element from the previously smallest element's sequence. This implementation is stable.

Definition at line 215 of file losertree.h.

### template\<typename T , typename Comparator \> int \_\_gnu\_parallel::LoserTreeBase\< T, Comparator \>::get\_min\_source ()` [inline]`, ` [inherited]`

**Returns:**

the index of the sequence with the smallest element.

Definition at line 152 of file losertree.h.

References \_\_gnu\_parallel::LoserTreeBase\< T, Comparator \>::losers, and \_\_gnu\_parallel::LoserTreeBase\< T, Comparator \>::Loser::source.

### template\<typename T , typename Comparator \> void \_\_gnu\_parallel::LoserTreeBase\< T, Comparator \>::insert\_start (const T &key, intsource, boolsup)` [inline]`, ` [inherited]`

Initializes the sequence 'source' with the element 'key'. **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.

References \_\_gnu\_parallel::LoserTreeBase\< T, Comparator \>::first\_insert, \_\_gnu\_parallel::LoserTreeBase\< T, Comparator \>::Loser::key, \_\_gnu\_parallel::LoserTreeBase\< T, Comparator \>::losers, \_\_gnu\_parallel::LoserTreeBase\< T, Comparator \>::Loser::source, and \_\_gnu\_parallel::LoserTreeBase\< T, Comparator \>::Loser::sup.

## Member Data Documentation

### template\<typename T , typename Comparator \> unsigned int \_\_gnu\_parallel::LoserTreeBase\< T, Comparator \>::\_M\_log\_k` [protected]`, ` [inherited]`

log\_2{k}

Definition at line 74 of file losertree.h.

Referenced by \_\_gnu\_parallel::LoserTreeBase\< T, Comparator \>::LoserTreeBase().

### template\<typename T , typename Comparator \> Comparator \_\_gnu\_parallel::LoserTreeBase\< T, Comparator \>::comp` [protected]`, ` [inherited]`

Comparator to use.

Definition at line 80 of file losertree.h.

### template\<typename T , typename Comparator \> bool \_\_gnu\_parallel::LoserTreeBase\< T, Comparator \>::first\_insert` [protected]`, ` [inherited]`

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().

### template\<typename T , typename Comparator \> Loser\* \_\_gnu\_parallel::LoserTreeBase\< T, Comparator \>::losers` [protected]`, ` [inherited]`

**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().

## Author

Generated automatically by Doxygen for libstdc++ from the source code.
