fork download
  1. #include <iostream>
  2. #include <unordered_map>
  3.  
  4. using namespace std;
  5.  
  6. namespace std {
  7. template<>
  8. class hash<std::pair<int, int>> {
  9. public:
  10. size_t operator()(const std::pair<int, int> &p) const
  11. {
  12. return std::hash<int>()(p.first) ^ std::hash<int>()(p.second);
  13. }
  14. };
  15. }
  16.  
  17. int main()
  18. {
  19. std::pair <int, int> var1;
  20. var1=std::make_pair(10,20);
  21. cout<<"\n var1.f="<<var1.first<<"\t 2."<<var1.second<<"\n";
  22. std::unordered_map <std::pair <int,int>, int> yeah;
  23.  
  24. return 0;
  25. }
Success #stdin #stdout 0s 3428KB
stdin
Standard input is empty
stdout
 var1.f=10	 2.20