unordered_map / unordered_set中元组的通用哈希

为什么不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 {...}  }; 

以元组为键(Matthieu M.)构建无序地图显示了如何自动执行boost::tuple。有没有为c ++ 0x元组执行此操作而不使用可变参数模板?


largeQ
浏览 607回答 3
3回答
打开App,查看更多内容
随时随地看视频慕课网APP