C++ 0x添加hash<...>(...).
我找不到一个hash_combine函数,如boost中所示.实现这样的事最简洁的方法是什么?也许,使用C++ 0x xor_combine?
为什么不std::unordered_map<tuple<int, int>, string>开箱即用?必须为tuple<int, int>例如定义散列函数是繁琐的
template<> struct do_hash<tuple<int, int>>
{ size_t operator()(std::tuple<int, int> const& tt) const {...} };
Run Code Online (Sandbox Code Playgroud)
构建一个以元组为键的无序映射(Matthieu M.)展示了如何自动执行此操作boost::tuple.有没有为c ++ 0x元组执行此操作而不使用可变参数模板?
当然这应该在标准:(