1 #ifndef MSP_CORE_MAPUTILS_H_
2 #define MSP_CORE_MAPUTILS_H_
9 class key_error: public std::runtime_error
12 key_error(const std::type_info &);
17 typename T::mapped_type &get_item(T &map, const typename T::key_type &key)
19 typename T::iterator i = map.find(key);
21 throw key_error(typeid(T));
27 const typename T::mapped_type &get_item(const T &map, const typename T::key_type &key)
29 typename T::const_iterator i = map.find(key);
31 throw key_error(typeid(T));
37 const typename T::iterator insert_unique(T &map, const typename T::key_type &key, const typename T::mapped_type &item)
40 throw key_error(typeid(T));
42 return map.insert(typename T::value_type(key, item)).first;