fork download
  1. #include <iostream>
  2. #include <set>
  3. #include <tuple>
  4.  
  5. using namespace std;
  6.  
  7. class State{
  8. public:
  9. int a;
  10. int b;
  11. State(int a1, int b1){
  12. a = a1;
  13. b = b1;
  14. }
  15. };
  16.  
  17. class Node{
  18. public:
  19. State *s;
  20. Node(State *s1){
  21. s = s1;
  22. }
  23. Node(){
  24. s = NULL;
  25. }
  26. };
  27. bool operator==(const State &s1, const State &s2){
  28. if(s1.a == s2.a && s1.b == s2.b)
  29. return true;
  30. else
  31. return false;
  32. }
  33. bool operator<(const State &lhs, const State &rhs){
  34. return tie(lhs.a, lhs.b) < tie(rhs.a, rhs.b);
  35. }
  36. bool operator>(const State &s1, const State &s2){
  37. if(s1.a > s2.a && s1.b > s2.b)
  38. return true;
  39. else
  40. return false;
  41. }
  42. int main() {
  43. State *s = new State(5, 6);
  44. State *z = new State(5, 6);
  45. Node *n = new Node(s);
  46. set<State> states;
  47. states.insert(*s);
  48. cout<<states.count(*z);
  49. return 0;
  50. }
Success #stdin #stdout 0s 3460KB
stdin
Standard input is empty
stdout
1