Looking at cppreference, one can see that all std::map
lookup functions (count
, finds
, contains
, equal_range
, lower_bound
, upper_bound
) have an overload taking a generic key argument (template< class K >
) that is enabled if the comparator is transparent.
Why doesn't std::map::at
offer the same overload taking a generic key type? It seems to me that std::map<std::string, T>::at
would benefit from being able to take a std::string_view
argument and not having to construct a temporary std::string
key for the access.
I think it has something to do with strict weak ordering but I'm not sure.