Template Class FlatLoserTree

Nested Relationships

Nested Types

Class Documentation

template<class T, class C = std::less<>>
class FlatLoserTree

the tree of losers of k sources with the keys in its nodes, the winner the smallest key by less, the lower source on equal keys

Public Functions

explicit FlatLoserTree(std::size_t k, C less = C())

the tree of k sources, all exhausted

Pre:

k >= 1 and k < 2^31

std::size_t sources(void) const

k, the sources

void start(std::size_t s, const T &x)

before build(): the source s starts with the key x, whose address is kept if T is large

Pre:

s < k

void build(void)

plays the matches of the keys given by start()

bool empty(void) const

all the sources exhausted

std::size_t winner(void) const

the source with the smallest key

Pre:

! empty()

const T &top(void) const

its key

Pre:

! empty()

void replaceTop(const T &x)

the winner takes the key x, and the matches on its path are replayed

Pre:

! empty()

void exhaustTop(void)

the winner is exhausted, and the matches on its path are replayed

Pre:

! empty()