From 9e001b4b4884d7945b857a4819815092983efcbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johel=20Ernesto=20Guerrero=20Pe=C3=B1a?= Date: Sun, 31 May 2020 13:42:55 -0400 Subject: [PATCH] refactor: non-member operators to use terse syntax --- src/include/units/quantity_point.h | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/include/units/quantity_point.h b/src/include/units/quantity_point.h index 07c6c5cd..46f489d6 100644 --- a/src/include/units/quantity_point.h +++ b/src/include/units/quantity_point.h @@ -202,33 +202,25 @@ public: template U, Scalar Rep> quantity_point(quantity) -> quantity_point; -template -[[nodiscard]] constexpr QuantityPoint AUTO operator+(const quantity_point& lhs, - const quantity& rhs) +[[nodiscard]] constexpr QuantityPoint AUTO operator+(const QuantityPoint AUTO& lhs, const Quantity AUTO& rhs) requires requires { lhs.relative() + rhs; } { return quantity_point(lhs.relative() + rhs); } -template -[[nodiscard]] constexpr QuantityPoint AUTO operator+(const quantity& lhs, - const quantity_point& rhs) +[[nodiscard]] constexpr QuantityPoint AUTO operator+(const Quantity AUTO& lhs, const QuantityPoint AUTO& rhs) requires requires { rhs + lhs; } { return rhs + lhs; } -template -[[nodiscard]] constexpr QuantityPoint AUTO operator-(const quantity_point& lhs, - const quantity& rhs) +[[nodiscard]] constexpr QuantityPoint AUTO operator-(const QuantityPoint AUTO& lhs, const Quantity AUTO& rhs) requires requires { lhs.relative() - rhs; } { return quantity_point(lhs.relative() - rhs); } -template -[[nodiscard]] constexpr Quantity AUTO operator-(const quantity_point& lhs, - const quantity_point& rhs) +[[nodiscard]] constexpr Quantity AUTO operator-(const QuantityPoint AUTO& lhs, const QuantityPoint AUTO& rhs) requires requires { lhs.relative() - rhs.relative(); } { return lhs.relative() - rhs.relative();