---
name: "__gnu_parallel::LoserTree"
section: "3"
platform: "linux"
package: "libstdc++6-4.3-doc"
version: "4.3.2-1.1"
release: "Debian 5.0 (Lenny)"
platforms: ["linux"]
url: "https://new.carta.tech/__gnu_parallel::LoserTree"
---

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

## NAME

\_\_gnu\_parallel::LoserTree -

## SYNOPSIS

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

## 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 171 of file losertree.h.

### 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**\

## Member Function Documentation

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

Delete the smallest element and insert a new element from the previously smallest element's sequence.

This implementation is stable.

Definition at line 221 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 158 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, int source, bool sup)` [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 137 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 80 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 86 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 93 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 83 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.
