C/C++ Arena

Step 2 of 5

operator== and !=

For comparisons, define operator==. Since C++20 the compiler automatically gives you != from it. You can even ask it to generate == for you, comparing every member:

struct Point {
    int x, y;
    bool operator==(const Point&) const = default;
};

Your turn: write operator== for Score by hand. Two scores are equal if both teams' round counts match; the map name doesn't matter.

Previous: operator+ Next: Printing with operator<<