This class can associate values of different types to a key. More...
#include <multi_type_map.hpp>
Public Types | |
typedef Key | key_type |
typedef TypeList::head_type | value_type |
typedef multi_type_map< Key, TypeList > | self_type |
typedef multi_type_map< Key, typename TypeList::queue_type > | super |
typedef std::map< key_type, value_type > | container_type |
Public Member Functions | |
template<typename ValueType > | |
const ValueType & | get (const key_type &k) const |
Get a value from the map. | |
template<typename ValueType > | |
void | set (const key_type &k, const ValueType &v) |
Set a value in the map. | |
template<typename ValueType > | |
bool | exists (const key_type &k) const |
Tell if the map contains a value of a given type with a given key. | |
Private Attributes | |
container_type | m_data |
Data stored for the first type of the list. | |
Friends | |
struct | multi_type_map_wrapper< value_type, multi_type_map< key_type, TypeList > >::last_call |
This class can associate values of different types to a key.
Template parameters
Type requirements
Example
multi_type_map<int, type_list<std::string, type_list<int, no_type> > > my_map;
Definition at line 61 of file multi_type_map.hpp.
typedef std::map<key_type, value_type> claw::multi_type_map< Key, TypeList >::container_type |
Definition at line 69 of file multi_type_map.hpp.
typedef Key claw::multi_type_map< Key, TypeList >::key_type |
Definition at line 65 of file multi_type_map.hpp.
typedef multi_type_map<Key, TypeList> claw::multi_type_map< Key, TypeList >::self_type |
Definition at line 67 of file multi_type_map.hpp.
typedef multi_type_map<Key, typename TypeList::queue_type> claw::multi_type_map< Key, TypeList >::super |
Definition at line 68 of file multi_type_map.hpp.
typedef TypeList::head_type claw::multi_type_map< Key, TypeList >::value_type |
Definition at line 66 of file multi_type_map.hpp.
bool claw::multi_type_map< Key, TypeList >::exists | ( | const key_type & | k | ) | const [inline] |
Tell if the map contains a value of a given type with a given key.
k | The key of the value to get. |
Definition at line 237 of file multi_type_map.tpp.
const ValueType & claw::multi_type_map< Key, TypeList >::get | ( | const key_type & | k | ) | const [inline] |
Get a value from the map.
k | The key of the value to get. |
Definition at line 209 of file multi_type_map.tpp.
void claw::multi_type_map< Key, TypeList >::set | ( | const key_type & | k, | |
const ValueType & | v | |||
) | [inline] |
Set a value in the map.
k | The key of the value to set. | |
v | The value to set. |
Definition at line 224 of file multi_type_map.tpp.
friend struct multi_type_map_wrapper< value_type,multi_type_map< key_type,TypeList > >::last_call [friend] |
Definition at line 73 of file multi_type_map.hpp.
container_type claw::multi_type_map< Key, TypeList >::m_data [private] |
Data stored for the first type of the list.
Definition at line 87 of file multi_type_map.hpp.