We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
To reproduce, try to compile:
#include "Graph.hpp" int main() { algorithms::GraphAdjList<std::pair<int, int>> a(1); return 0; }
The text was updated successfully, but these errors were encountered:
This is expected, as C++ does not provide a hash function for std::pair by default. A workaround (some code adapted from https://en.cppreference.com/w/cpp/utility/hash):
std::pair
#include "Graph.hpp" namespace std { template<> struct hash<std::pair<int, int>> { std::size_t operator()(std::pair<int, int> const& s) const noexcept { std::size_t h1 = std::hash<int>{}(s.first); std::size_t h2 = std::hash<int>{}(s.second); return h1 ^ (h2 << 1); // or use boost::hash_combine } }; } int main() { algorithms::GraphAdjList<std::pair<int, int>> a(1); // std::hash<std::pair<int, int>> a; return 0; }
Sorry, something went wrong.
No branches or pull requests
To reproduce, try to compile:
The text was updated successfully, but these errors were encountered: