Jump to content
TrinityCore

Problem for C++ Standard


taoshan
 Share

Recommended Posts

hi , i must to add this commit for tdb 52 :

https://github.com/TrinityCore/TrinityCore/commit/2da458c56d024aac04468ce2af454a83ad790bf6

but i have a error : The C++ Standard doesn't provide a hash for this type.

Does anyone know how to convert this for compiler under VS 2013 ?

 

typedef std::pair<int32, int32> coordinate;
std::queue<coordinate> Q;
std::unordered_set<coordinate> alreadyChecked;
std::unordered_set<coordinate> outOfBounds;

Link to comment
Share on other sites

You need to provide a custom hash function for the `coordinate` type since the compiler doesn't know how you want to hash this custom type:

struct Hasher {

  std::size_t operator() (coordinate const& right) const {
    return ... ;
  }
};

std::unordered_set<coordinate, Hasher> ... 

 

For hashing the two ints you could use std::hash and combine it using boost::hash::combine

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...