|
| HashMap () |
|
| HashMap (const HM_t &map) |
|
| ~HashMap () |
|
HM_t & | operator= (const HM_t &map) |
|
bool | contains (const Key &key) const |
|
Val & | operator[] (const Key &key) |
|
const Val & | operator[] (const Key &key) const |
|
Val & | getOrCreateVal (const Key &key) |
|
Val & | getVal (const Key &key) |
|
const Val & | getVal (const Key &key) const |
|
const Val & | getValOrDefault (const Key &key) const |
|
const Val & | getValOrDefault (const Key &key, const Val &defaultVal) const |
|
bool | tryGetVal (const Key &key, Val &out) const |
|
void | setVal (const Key &key, const Val &val) |
|
void | clear (bool shrinkArray=0) |
|
void | erase (iterator entry) |
|
void | erase (const Key &key) |
|
size_type | size () const |
|
iterator | begin () |
|
iterator | end () |
|
const_iterator | begin () const |
|
const_iterator | end () const |
|
iterator | find (const Key &key) |
|
const_iterator | find (const Key &key) const |
|
bool | empty () const |
|
template<class Key, class Val, class HashFunc = Hash<Key>, class EqualFunc = EqualTo<Key>>
class Common::HashMap< Key, Val, HashFunc, EqualFunc >
HashMap<Key,Val> maps objects of type Key to objects of type Val. For each used Key type, a "size_type hashit(Key,size_type)" function is required that computes a hash for the given Key object and returns it as an integer from 0 to hashsize-1. An "equality functor" is also required that returns true if its two arguments are to be considered equal. Also, it is assumed that "=" works on Val objects for assignment.
If aa is a HashMap<Key,Val>, then space is allocated each time aa[key] is referenced, for a new key. If the object is const, then an assertion is triggered instead. Hence, if you are not sure whether a key is contained in the map, use contains() first to check for its presence.