fork download
  1. #include <unordered_map>
  2. #include <vector>
  3. #include <bitset>
  4. #include <string>
  5. #include <utility>
  6.  
  7.  
  8. struct IntTriple
  9. {
  10. int a, b, c;
  11.  
  12. IntTriple(int a = 0, int b = 0, int c = 0)
  13. : a(a), b(b), c(c)
  14. { }
  15.  
  16. bool operator==(IntTriple const& oth) const
  17. {
  18. return this->a == oth.a && this->b == oth.b && this->c == oth.c;
  19. }
  20. };
  21.  
  22.  
  23. struct IntTripleHash {
  24. std::size_t operator()(const IntTriple& k) const
  25. {
  26. return k.a + k.b + k.c;
  27. //return k.a + 100*k.b + 10000*k.c
  28. // hier bessere Funktionen bauen
  29. }
  30. };
  31.  
  32. int main()
  33. {
  34. std::unordered_map<IntTriple, std::string, IntTripleHash> l1;
  35.  
  36. l1[IntTriple(1, 2, 3)] = "abc";
  37. l1[IntTriple(1, 2, 5)] = "cbde";
  38. }
Success #stdin #stdout 0s 3428KB
stdin
Standard input is empty
stdout
Standard output is empty