9 #ifndef snap_core_priorityqueue_h
10 #define snap_core_priorityqueue_h
23 void Insert(
const TVal& X,
float Priority) {
58 IAssertR(
Size() > 0,
"Attempt to query max priority of empty priority queue.");
63 IAssertR(
Size() > 0,
"Attempt to query max priority of empty priority queue.");
94 int Parent(
int i) {
return (i + 1) / 2 - 1; }
95 int Left(
int i) {
return i * 2 + 1; }
96 int Right(
int i) {
return i * 2 + 2; }
#define IAssertR(Cond, Reason)
float GetPriority(const TVal &X)
void GetPriorities(THash< TVal, TFlt > &Result)
TSizeTy Len() const
Returns the number of elements in the vector.
const TDat & GetDat(const TKey &Key) const
void Swap(TVec< TVal, TSizeTy > &Vec)
Swaps the contents of the vector with Vec.
void DelKey(const TKey &Key)
void SetPriority(const TVal &X, float NewPriority)
void Insert(const TVal &X, float Priority)
THash< TVal, int > ValToIndex
bool IsKey(const TKey &Key) const
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
void DelLast()
Removes the last element of the vector.
TDat & AddDat(const TKey &Key)