How can I make an unordered set of pairs of integers in C++?
There is no standard way of computing a hash on a pair. Add this definition to your file: struct pair_hash { inline std::size_t operator()(const std::pair<int,int> & v) const { return v.first*31+v.second; } }; Now you can use it like this: std::unordered_set< std::pair<int, int>, pair_hash> u_edge_; This works, because pair<T1,T2> defines equality. For custom classes that … Read more