SimpleHeap Class Template Reference

A heap class that uses standard C/C++ data types for keys. More...

#include <SimpleHeap.h>

Inheritance diagram for SimpleHeap::

AbstractHeap< SimpleHeapItem< T >, T > List of all members.

Public Methods

 SimpleHeap (const char *nameBuff="Unnamed")
 Constructor, which specifies a name for the tree.

bool & duplicate ()
 Returns the value of duplicate_flag.

bool & check_duplicates ()
 Returns the value of check_duplicates_flag.


Protected Methods

SimpleHeapItem< T > * insert (T *key)
void extract (SimpleHeapItem< T > *item, bool &status)

Protected Attributes

bool duplicate_flag
 Records whether the last item inserted was a duplicate.

bool check_duplicates_flag
 If true then track items in the tree that are duplicates.


Detailed Description

template<class T>
class SimpleHeap< T >

A heap class that uses standard C/C++ data types for keys.

The SimpleHeap class is derived from AbstractHeap, which defines the basic operations of the heap. This particular instantiation of heaps uses a simple data type for the key, and no auxillary data is associated with the key. This greatly simplifies the definition of the heap, but it assumes that copying the key is relatively inexpensive (e.g. no memory allocation/deallocation is required).

This template class can be instantiated with a data type for which the following methods are defined:

See also:
GenericHeap
TODO: evaluate how the use of duplicates relates to the semantics of the add/move/remove effects.


The documentation for this class was generated from the following file: