|
| BlamMap () |
| Constructs a new BlamMap. More...
|
|
| BlamMap (std::map< KeyType, ValueType > std_map) |
| Constructs a new BlamMap. More...
|
|
int | Size () |
| Returns the number of pairs within the map. More...
|
|
ValueType | At (KeyType key) |
| Retrieves the value associated with the specified key. More...
|
|
BlamMapPair< KeyType, ValueType > | PairAt (int index) |
| Retrieves the pair at the specified index. More...
|
|
void | Add (std::pair< KeyType, ValueType > pair) |
| Adds a new key/value pair to the map. More...
|
|
void | Add (KeyType key, ValueType value) |
| Adds a new key/value pair to the map. More...
|
|
bool | Contains (KeyType key) |
| Checks if the map has a pair with the given key. More...
|
|
std::vector< KeyType > | KeySet () |
| Creates a list of all keys within the map. More...
|
|
std::vector< ValueType > | Values () |
| Creates a list of all values within the map. More...
|
|
std::map< KeyType, ValueType > | ToStdMap () |
| Converts the map to a std::map. More...
|
|
bool | GetFirstKey (ValueType value, KeyType *out_key) |
| Attempts to locate a pair within the map with a specified value. More...
|
|
template<typename KeyType, typename ValueType>
class BlamMap< KeyType, ValueType >
Class representing a BlamMap.
BlamMaps are functionally identical to a std::map. However, they are designed to be simpler to use overall, and require less code to interact with. They also provide a number of unique methods that are normally not part of a typical map class.
template<typename KeyType , typename ValueType >
bool BlamMap< KeyType, ValueType >::GetFirstKey |
( |
ValueType |
value, |
|
|
KeyType * |
out_key |
|
) |
| |
|
inline |
Attempts to locate a pair within the map with a specified value.
This does not search for a value at the specified key - rather, it acts in reverse - looking for a key with the specified value. Note that a value may correlate to multiple keys. As such, this method will return the first matching value - even if there are other possible matches.
- Parameters
-
value | - The value to search for. |
out_key | - Output parameter. If a matching value is found, this will be set to the associated key. |
- Returns
true
if the desired key was located. If out_key was nullptr
, or if the map did not have any pairs with the specified value, then this will return false
.