Move point helpers elsewhere
This commit is contained in:
parent
e52c38a68f
commit
2df2b58d3e
2 changed files with 32 additions and 0 deletions
24
spec/runtime/helpers/point_helpers.cc
Normal file
24
spec/runtime/helpers/point_helpers.cc
Normal 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;
|
||||
}
|
||||
8
spec/runtime/helpers/point_helpers.h
Normal file
8
spec/runtime/helpers/point_helpers.h
Normal 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);
|
||||
Loading…
Add table
Add a link
Reference in a new issue