|
Darwin
1.10(beta)
|
Provides a datastructure for that can be indexed by a KeyType (usually a string) or unsigned integer, i.e., the index.
More...
Public Member Functions | |
| drwnOrderedMap () | |
| default constructor | |
| drwnOrderedMap (const drwnOrderedMap< KeyType, ValueType > &m) | |
| copy constructor | |
| ~drwnOrderedMap () | |
| destructor | |
| void | clear () |
| clear all entries from the map | |
| size_t | size () const |
| returns the number of entries in the map | |
| void | insert (const KeyType &key, const ValueType &v) |
Inserts value v into the map at the end position with key key. If the key already exists then the value for the entry is replaced and it's index is unchanged. | |
| void | erase (const KeyType &key) |
remove the entry in the map corresponding to key key | |
| int | find (const KeyType &key) const |
| find the index of an entry in the map (-1 if the key does not exist) | |
|
drwnOrderedMap< KeyType, ValueType > & | operator= (const drwnOrderedMap< KeyType, ValueType > &m) |
| assignment operator | |
| const ValueType & | operator[] (unsigned int indx) const |
index the indx-th entry in the map | |
| ValueType & | operator[] (unsigned int indx) |
index the indx-th entry in the map | |
| const ValueType & | operator[] (const KeyType &key) const |
index the entry in the map with key key | |
| ValueType & | operator[] (const KeyType &key) |
index the entry in the map with key key | |
Protected Attributes | |
|
vector< pair< KeyType, ValueType > * > | _data |
| map< KeyType, unsigned > | _index |
Provides a datastructure for that can be indexed by a KeyType (usually a string) or unsigned integer, i.e., the index.
The unsigned integer variant indexes entries by insertion order. KeyType must be default constructable and cannot be an unsigned integer.
Example usage:
1.8.6