nie*_*ses 5 c++ hash standards boost
正如在回答指出了在unordered_map / unordered_set通用哈希元组和其他地方,加速了实现的boost::hash<tuple<string, string>>。
所以,我们可以做这样的事情:
#include <boost/functional/hash.hpp>
#include <boost/unordered_map.hpp>
std::tuple<string, string> t;
size_t bh = boost::hash<tuple<string, string>>{}(t);
boost::unordered_map<tuple<string, string>, int> bm;
Run Code Online (Sandbox Code Playgroud)
但不是:
size_t sh = std::hash<tuple<string, string>>{}(t); // error C2338: The C++ Standard doesn't provide a hash for this type.
std::unordered_map<tuple<string, string>, int> sm; // same error
Run Code Online (Sandbox Code Playgroud)
为什么它没有进入 C++ 标准?
由委员会或其他专家给出理由的参考文献的额外加分。