Skip to content

Instantly share code, notes, and snippets.

@rharriso
Last active April 29, 2017 02:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rharriso/495cffd534b8071edf517f253c6d60a1 to your computer and use it in GitHub Desktop.
Save rharriso/495cffd534b8071edf517f253c6d60a1 to your computer and use it in GitHub Desktop.
struct coord {
int i = 0;
int j = 0;
};
// equality comparison between two coors
inline bool operator == (const coord &lhs, const coord &rhs) {
return lhs.i == rhs.i && lhs.j == rhs.j;
}
// less then comparison between two coords
inline bool operator < (const coord &lhs, const coord &rhs) {
return lhs.i < rhs.i || (lhs.i == rhs.i && lhs.j < rhs.j);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment