https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96088
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to François Dumont from comment #1) > I'll check if we can be smarter here. A nice improvement would be to change > std::hash<std::string> operator signature to: > > size_t > operator()(const string_view& __str) const noexcept > > but that's a Standard modification. Or use unordered_map<string, int, hash<string_view>, equal_to<>> which should perform better. We haven't implemented http://wg21.link/p0919r3 and http://wg21.link/p1690r1 yet, I wonder if those would help, especially if we make the internal helpers available pre-C++20. That could allow the range insertion to use the heteregenous lookup, to avoid creating temporaries. I'm not sure if that would be conforming though. Heterogeneous lookup is observably different, and not conforming in C++17. Adding hash<string>::operator()(string_view) is an interesting idea for the standard though.