How to use is_transparent feature on a string literal with unordered_map from std::string?

c++, c++14, unordered-map

Solution

That was an error in cppreference; there are no templated finds for unordered associated containers.

Compare, from n3690,

from `§23.5.4.1[unord.map.overview]`

// lookup
iterator find(const key_type& k);
const_iterator find(const key_type& k) const;
size_type count(const key_type& k) const;

from `§23.4.4.1[map.overview]`

// 23.4.4.5, map operations:
iterator find(const key_type& x);
const_iterator find(const key_type& x) const;
template <class K> iterator find(const K& x);
template <class K> const_iterator find(const K& x) const;
size_type count(const key_type& x) const;

Problem

Looking around on cppreference, I found that `std::unordered_map` gets efficient lookup functions from "equivalent keys". I take that to mean that the equivalent key must have the same hash value. How can I provide that for a string literal I get the same hash value as for `std::hash<std::string>` without temporarily constructing an `std::string` and thereby making the whole point about the equivalent keys for naught?

Original source

Related problems