From f9e964e34dd39976eaba91913c6ccb66ab99d5f8 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Sun, 27 Oct 2019 00:01:25 +1000 Subject: [PATCH] CDImage: Relational operators for Position --- src/common/cd_image.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/common/cd_image.h b/src/common/cd_image.h index a3a406276..ba85ea04e 100644 --- a/src/common/cd_image.h +++ b/src/common/cd_image.h @@ -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.