diff --git a/src/sfizz/Range.h b/src/sfizz/Range.h index 7cbfb522..258323a8 100644 --- a/src/sfizz/Range.h +++ b/src/sfizz/Range.h @@ -7,7 +7,6 @@ #pragma once #include "MathHelpers.h" #include "Macros.h" -#include #include #include @@ -159,29 +158,16 @@ private: template using UncheckedRange = Range; +template +bool operator==(const Range& lhs, const Range& rhs) noexcept +{ + return lhs.getStart() == rhs.getStart() && lhs.getEnd() == rhs.getEnd(); } template -bool operator==(const sfz::Range& lhs, const sfz::Range& rhs) +bool operator!=(const Range& lhs, const Range& rhs) noexcept { - return (lhs.getStart() == rhs.getStart()) && (lhs.getEnd() == rhs.getEnd()); + return !operator==(lhs, rhs); } -template -bool operator!=(const sfz::Range& lhs, const sfz::Range& rhs) -{ - return (lhs.getStart() != rhs.getStart()) || (lhs.getEnd() != rhs.getEnd()); -} - - -template -bool operator==(const sfz::Range& lhs, const std::pair& rhs) -{ - return (lhs.getStart() == rhs.first) && (lhs.getEnd() == rhs.second); -} - -template -bool operator==(const std::pair& lhs, const sfz::Range& rhs) -{ - return rhs == lhs; -} +} // namespace sfz diff --git a/tests/RangeT.cpp b/tests/RangeT.cpp index 67cc21ef..eaa65b74 100644 --- a/tests/RangeT.cpp +++ b/tests/RangeT.cpp @@ -12,13 +12,9 @@ TEST_CASE("[Range] Equality operators") { sfz::Range intRange { 1, 1 }; REQUIRE(intRange == sfz::Range(1, 1)); - REQUIRE(intRange == std::pair(1, 1)); - REQUIRE(std::pair(1, 1) == intRange); sfz::Range floatRange { 1.0f, 1.0f }; REQUIRE(floatRange == sfz::Range(1.0f, 1.0f)); - REQUIRE(floatRange == std::pair(1.0f, 1.0f)); - REQUIRE(std::pair(1.0f, 1.0f) == floatRange); } TEST_CASE("[Range] Default ranges for classical types")