Is there a reason for missing transparent (template <class K> at(K&& key);
) in std::map
?
My guess is that std::map::at()
must be a "bounds-checked" version of std::map::operator[]()
. Providing a transparent version of std::map::operator[]()
imposes an additional requirement on std::map::key_type
and the query key type K
- if the query key is not in the map, it must be inserted (with default constructed value), which means that std::map::key_type
must be constructible from the query key type.