KrisLibrary  1.0.0
Public Types | Public Member Functions | List of all members
IndexedPriorityQueue< IT, PT > Class Template Reference

Contains a priority queue with an associated index, allowing updates of the priority value. Priority defined with lowest value first. More...

#include <IndexedPriorityQueue.h>

Public Types

typedef std::pair< PT, IT > value_type
 
typedef std::set< std::pair< PT, IT > >::iterator iterator
 
typedef std::set< std::pair< PT, IT > >::const_iterator const_iterator
 

Public Member Functions

iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const iterator end () const
 
const value_type & front () const
 
const value_type & back () const
 
bool empty () const
 
void clear ()
 
size_t size () const
 
const value_type & top () const
 
void erase (iterator i)
 
void pop ()
 
iterator insert (const value_type &item)
 
template<class InputIterator >
void insert (InputIterator i, InputIterator j)
 
iterator insert (const IT &index, const PT &p)
 
iterator find (const IT &index)
 
iterator refresh (const IT &index, const PT &p)
 
bool is_valid () const
 

Detailed Description

template<class IT, class PT>
class IndexedPriorityQueue< IT, PT >

Contains a priority queue with an associated index, allowing updates of the priority value. Priority defined with lowest value first.

An index is provided with each priority queue entry, allowing a priority value to be located from an index in logarithmic time.

IT is the type of the index. PT is the type of the priority value. It is assumed that the < operator has been defined for both types.

Most members operate like STL's priority_queue<pair<PT,IT> >. Be sure to remember that the returned pair has PT as its first type, and IT as its second!

The new members are as follows:

One index value can only map to one priority value (that is, insert(2,0.5) and insert(2,0.7) is an invalid operation).

Undefined behavior will result if any iterator is modified.


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