18 template<
typename KeyType,
typename ValueType>
21 typedef std::map<KeyType, ValueType> map_impl;
22 typedef typename map_impl::value_type KeyValuePair;
26 void insert(
const KeyType& key,
const ValueType &v)
29 bool newKey = map_.insert(std::make_pair(key, v)).second;
34 void insert(
const KeyType& key)
37 bool newKey = map_.insert(std::make_pair(key, ValueType())).second;
42 bool has_key(
const KeyType& key)
const
45 typename map_impl::const_iterator i = map_.find(key);
46 return i != map_.end();
50 KeyValuePair& find(
const KeyType& key)
53 typename map_impl::iterator i = map_.find(key);
59 const KeyValuePair& find(
const KeyType& key)
const
62 typename map_impl::const_iterator i = map_.find(key);
68 ValueType& operator[](
const KeyType& key)
71 return find(key).second;
75 const ValueType& operator[](
const KeyType& key)
const
78 return find(key).second;
82 void erase(
const KeyType& key)
85 unsigned erased = map_.erase(key);
98 friend class NUKLEI_SERIALIZATION_FRIEND_CLASSNAME;
99 template<
class Archive>
100 void serialize(Archive &ar,
const unsigned int version)
102 ar & NUKLEI_SERIALIZATION_NVP(map_);