CDImage: Relational operators for Position

This commit is contained in:
Connor McLaughlin 2019-10-27 00:01:25 +10:00
parent 88eec0a56b
commit f9e964e34d
1 changed files with 15 additions and 0 deletions

View File

@ -76,6 +76,21 @@ public:
*this = *this + pos;
return *this;
}
#define RELATIONAL_OPERATOR(op) \
bool operator##op(const Position& rhs) const \
{ \
return std::tie(minute, second, frame) op std::tie(rhs.minute, rhs.second, rhs.frame); \
}
RELATIONAL_OPERATOR(==);
RELATIONAL_OPERATOR(!=);
RELATIONAL_OPERATOR(<);
RELATIONAL_OPERATOR(<=);
RELATIONAL_OPERATOR(>);
RELATIONAL_OPERATOR(>=);
#undef RELATIONAL_OPERATOR
};
// Opening disc image.