CoreComponents 3.0.0
A Modern C++ Toolkit
Loading...
Searching...
No Matches
Heap< T, Order > Class Template Reference

Fixed-size heap More...

#include <cc/Heap>

Public Member Functions

Heap allocate (long n)
 Create a new heap holding up to n items.
 
 Heap (Dim<> dim)
 Create a new heap holding up to n items.
 
bool isFull () const
 Heap is full.
 
bool isEmpty () const
 Heap is empty.
 
long size () const
 Maximum number of items storable.
 
long fill () const
 Current number of items stored.
 
void push (const T &item)
 Add new item to the heap.
 
void pop (Out< T > item)
 Remove the top of the heap.
 
pop ()
 Remove the top of the heap.
 
const T & top ()
 Get the top of the heap (i.e.
 
void deplete ()
 Remove all items.
 

Detailed Description

template<class T, class Order = ReverseOrder>
class cc::Heap< T, Order >

Fixed-size heap

Template Parameters
TItem type
OrderSorting order

Constructor & Destructor Documentation

◆ Heap()

template<class T , class Order = ReverseOrder>
Heap ( Dim<> dim)
explicit

Create a new heap holding up to n items.

Member Function Documentation

◆ allocate()

template<class T , class Order = ReverseOrder>
Heap allocate ( long n)

Create a new heap holding up to n items.

◆ isFull()

template<class T , class Order = ReverseOrder>
bool isFull ( ) const

Heap is full.

◆ isEmpty()

template<class T , class Order = ReverseOrder>
bool isEmpty ( ) const

Heap is empty.

◆ size()

template<class T , class Order = ReverseOrder>
long size ( ) const

Maximum number of items storable.

◆ fill()

template<class T , class Order = ReverseOrder>
long fill ( ) const

Current number of items stored.

◆ push()

template<class T , class Order = ReverseOrder>
void push ( const T & item)

Add new item to the heap.

◆ pop() [1/2]

template<class T , class Order = ReverseOrder>
void pop ( Out< T > item)

Remove the top of the heap.

◆ pop() [2/2]

template<class T , class Order = ReverseOrder>
T pop ( )

Remove the top of the heap.

◆ top()

template<class T , class Order = ReverseOrder>
const T & top ( )

Get the top of the heap (i.e.

the minimum if Order is DefaultOrder)

◆ deplete()

template<class T , class Order = ReverseOrder>
void deplete ( )

Remove all items.