GClasses
GClasses::GIndexedMultiSet< T > Class Template Reference

Detailed Description

template<typename T>
class GClasses::GIndexedMultiSet< T >

A multiset class that can be queried by index. It is implemented using a balanced tree structure, so most operations take O(log(n)) time.

#include <GTree.h>

Public Member Functions

 GIndexedMultiSet ()
 General-purpose constructor. More...
 
 ~GIndexedMultiSet ()
 
void drop_by_index (size_t index)
 Drop the value at the specified index (in sorted order, beginning with 0). More...
 
void drop_by_value (const T &key)
 Drop one occurrence of the specified value from this multiset. An exception is thrown if the value does not occur in the multiset. More...
 
size_t find (T key)
 Returns the index of one occurrence of the specified value in this multiset. If the value occurs multiple times, the returned index is arbitrarily chosen from among them. More...
 
get (size_t index)
 Return the value at the specified index in this multiset (in sorted order, beginning with 0). More...
 
void insert (const T &key)
 Insert a value into the multiset. More...
 
void print ()
 Print a representation of the tree to stdout. More...
 
size_t size ()
 Return the total number of values in this multiset. More...
 

Constructor & Destructor Documentation

template<typename T>
GClasses::GIndexedMultiSet< T >::GIndexedMultiSet ( )
inline

General-purpose constructor.

template<typename T>
GClasses::GIndexedMultiSet< T >::~GIndexedMultiSet ( )
inline

Member Function Documentation

template<typename T>
void GClasses::GIndexedMultiSet< T >::drop_by_index ( size_t  index)
inline

Drop the value at the specified index (in sorted order, beginning with 0).

template<typename T>
void GClasses::GIndexedMultiSet< T >::drop_by_value ( const T &  key)
inline

Drop one occurrence of the specified value from this multiset. An exception is thrown if the value does not occur in the multiset.

template<typename T>
size_t GClasses::GIndexedMultiSet< T >::find ( key)
inline

Returns the index of one occurrence of the specified value in this multiset. If the value occurs multiple times, the returned index is arbitrarily chosen from among them.

template<typename T>
T GClasses::GIndexedMultiSet< T >::get ( size_t  index)
inline

Return the value at the specified index in this multiset (in sorted order, beginning with 0).

template<typename T>
void GClasses::GIndexedMultiSet< T >::insert ( const T &  key)
inline

Insert a value into the multiset.

template<typename T>
void GClasses::GIndexedMultiSet< T >::print ( )
inline

Print a representation of the tree to stdout.

template<typename T>
size_t GClasses::GIndexedMultiSet< T >::size ( )
inline

Return the total number of values in this multiset.