unordered_map hash function c++

后端 未结 3 1704
粉色の甜心
粉色の甜心 2020-11-27 04:14

I need to define an unordered_map like this unordered_map, *Foo>, what is the syntax for defining and passing a hash and

3条回答
  •  伪装坚强ぢ
    2020-11-27 04:25

    If you are fine with using Boost, a cleaner solution is to rely on Boost's implementation of the hash function for pairs (which in fact does exactly what kerrek-sb explains in his answer). Therefore all you have to do is:

    #include 
    #include 
    
    using namespace std;
    using namespace boost;
    
    unordered_map, int, hash>> table;
    

提交回复
热议问题