41 字
1 分钟
Transparent_operators
class Hasher {
public:
using is_transparent = void;
size_t operator()(std::string_view sv) const {
return std::hash<std::string_view>{}(sv);
}
};
// 统一的哈希方法,避免const string &, const char *等类型的实现问题Transparent_operators
https://anthosq.github.io/posts/transparent_operators/