wilderfield
Classes | Public Member Functions | List of all members
wilderfield::PriorityMap< KeyType, ValType, Compare, Hash > Class Template Referencefinal

Priority map class. More...

#include <priority_map.hpp>

Classes

class  Proxy
 

Public Member Functions

std::size_t Size () const
 Returns the number of unique keys in the priority map.
 
bool Empty () const
 Checks whether the priority map is empty.
 
std::size_t Count (const KeyType &key) const
 Returns the count of a particular key in the map.
 
std::pair< KeyType, ValType > Top () const
 Returns the top element (key-value pair) in the priority map.
 
std::size_t Erase (const KeyType &key)
 
void Pop ()
 Removes the top element from the priority map.
 
Proxy operator[] (const KeyType &key)
 

Detailed Description

template<typename KeyType, typename ValType, typename Compare = std::greater<ValType>, typename Hash = std::hash<KeyType>>
class wilderfield::PriorityMap< KeyType, ValType, Compare, Hash >

Priority map class.

Implements a priority map where each key is associated with a priority value. The map maintains the keys in sorted order based on their priority, allowing for efficient retrieval and modification of priorities.

Template Parameters
KeyTypeThe type of the keys.
ValTypeThe type of the values (priorities), must be numeric.
CompareComparison class used to maintain the ordering of values.
HashHashing class used for keys.

Member Function Documentation

◆ Erase()

template<typename KeyType , typename ValType , typename Compare , typename Hash >
std::size_t wilderfield::PriorityMap< KeyType, ValType, Compare, Hash >::Erase ( const KeyType &  key)

Erases key from the priority map. Returns the number of elements removed (0 or 1).


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