Move point helpers elsewhere

This commit is contained in:
joshvera 2015-12-02 17:28:52 -05:00
parent e52c38a68f
commit 2df2b58d3e
2 changed files with 32 additions and 0 deletions

View file

@ -0,0 +1,24 @@
#include <string>
#include <ostream>
#include "runtime/length.h"
using namespace std;
bool operator==(const TSPoint &left, const TSPoint &right) {
return left.row == right.row && left.column == right.column;
}
std::ostream &operator<<(std::ostream &stream, const TSPoint &point) {
return stream << "{" << point.row << ", " << point.column << "}";
}
bool operator<(const TSPoint &left, const TSPoint &right) {
if (left.row < right.row) return true;
if (left.row > right.row) return false;
return left.column < right.column;
}
bool operator>(const TSPoint &left, const TSPoint &right) {
return right < left;
}

View file

@ -0,0 +1,8 @@
bool operator==(const TSPoint &left, const TSPoint &right);
bool operator<(const TSPoint &left, const TSPoint &right);
bool operator>(const TSPoint &left, const TSPoint &right);
std::ostream &operator<<(std::ostream &stream, const TSPoint &point);