4129
map::operator[](k) is indeed equivalent to (*((this->insert(make_pair(k,mapped_type()))).first)).second
This commit is contained in:
parent
bc4d02c848
commit
82f3c320ea
|
@ -220,8 +220,8 @@ template<typename T> typename T::mapped_type const& get(const T& map, typename T
|
|||
}
|
||||
template<typename T> typename T::mapped_type const& put(T& map, typename T::key_type const& key, typename T::mapped_type const& value) {
|
||||
// requires value to have a zero-arg (default) constructor
|
||||
map[key] = value;
|
||||
return map[key];
|
||||
(*((map.insert(std::make_pair(key, typename T::mapped_type()))).first)).second = value;
|
||||
return (*((map.insert(std::make_pair(key, typename T::mapped_type()))).first)).second;
|
||||
}
|
||||
template<typename T> bool contains_key(T& map, typename T::key_type const& key) {
|
||||
return map.find(key) != map.end();
|
||||
|
|
Loading…
Reference in New Issue
Block a user