---
name: "__gnu_parallel::_LoserTree"
section: "3"
platform: "linux"
package: "gcc"
version: "16.2.1+r23+gd564253eb6c8-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/__gnu_parallel::_LoserTree"
---

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

Stable \_LoserTree variant.

## NAME

\_\_gnu\_parallel::\_LoserTree\< \_\_stable, \_Tp, \_Compare \> - Stable \_LoserTree variant.

## SYNOPSIS

\#include \<losertree.h\>

Inherits **\_\_gnu\_parallel::\_LoserTreeBase\< \_Tp, \_Compare \>**.

### Public Member Functions

**\_LoserTree** (unsigned int \_\_k, \_Compare \_\_comp)\
 void **\_\_delete\_min\_insert** (\_Tp \_\_key, bool \_\_sup)\
 Delete the smallest element and insert a new element from the previously smallest element's sequence.  int **\_\_get\_min\_source** ()\
 void **\_\_init** ()\
 unsigned int **\_\_init\_winner** (unsigned int \_\_root)\
 void **\_\_insert\_start** (const \_Tp &\_\_key, int \_\_source, bool \_\_sup)\
 Initializes the sequence *\_M\_source"*with*the*element*\_\_key*.

### Protected Attributes

unsigned int **\_M\_ik**\
 unsigned int **\_M\_log\_k**\
 unsigned int **\_M\_offset**\

## Detailed Description

### template\<bool \_\_stable, typename \_Tp, typename \_Compare\>

class \_\_gnu\_parallel::\_LoserTree\< \_\_stable, \_Tp, \_Compare \>"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.

## Member Function Documentation

### template\<bool \_\_stable, typename \_Tp, typename \_Compare\> void \_\_gnu\_parallel::\_LoserTree\< \_\_stable, \_Tp, \_Compare \>::\_\_delete\_min\_insert (\_Tp \_\_key, bool \_\_sup) \[inline\]

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

### template\<typename \_Tp, typename \_Compare\> int \_\_gnu\_parallel::\_LoserTreeBase\< \_Tp, \_Compare \>::\_\_get\_min\_source () \[inline\], \[inherited\]

**Returns**

the index of the sequence with the smallest element.

References **\_M\_losers**.

### template\<typename \_Tp, typename \_Compare\> void \_\_gnu\_parallel::\_LoserTreeBase\< \_Tp, \_Compare \>::\_\_insert\_start (const \_Tp & \_\_key, int \_\_source, bool \_\_sup) \[inline\], \[inherited\]

Initializes the sequence "\_M\_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.

References **\_M\_first\_insert**, and **\_M\_losers**.

## Member Data Documentation

### template\<typename \_Tp, typename \_Compare\> unsigned int \_\_gnu\_parallel::\_LoserTreeBase\< \_Tp, \_Compare \>::\_M\_log\_k \[protected\], \[inherited\]

log\_2{\_M\_k}

Referenced by **\_LoserTreeBase()**.

## Author

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