### cpp unordered_set just use comparator not hash

#include <unordered_set> #include <iostream> class edge{ public: float a1; float a2; }; struct comp{ bool operator()(const edge& e1, const edge& e2) const { return true; return ( (e1.a1==e2.a1 && e1.a2==e2.a2) || (e1.a1==e2.a2 && e1.a2==e2.a1) ); }; }; struct hash{ size_t operator()(const edge& e1) const { // return std::hash<float>()(e1.a1+e1.a2); return std::hash<float>()(e1.a1+e1.a2*2); }; }; int main() {…

Details