From 5735a3525f9f3e9a928ca03d2146396447bbd523 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Wed, 1 May 2024 23:07:44 -0400 Subject: [PATCH] xo-unit: share operator impls --- include/xo/unit/quantity_ops.hpp | 11 +++++++++++ include/xo/unit/xquantity.hpp | 20 -------------------- 2 files changed, 11 insertions(+), 20 deletions(-) diff --git a/include/xo/unit/quantity_ops.hpp b/include/xo/unit/quantity_ops.hpp index 63be47c0..5b4513bb 100644 --- a/include/xo/unit/quantity_ops.hpp +++ b/include/xo/unit/quantity_ops.hpp @@ -47,6 +47,17 @@ namespace xo { { return (Quantity::compare(x, y) == 0); } + + /** note: won't have constexpr result until c++26 (when ::sqrt(), ::pow() are constexpr) + **/ + template + requires quantity2_concept && quantity2_concept + constexpr auto + operator<=> (const Quantity & x, const Quantity2 & y) + { + return Quantity::compare(x, y); + } + } /*namespace qty*/ } /*namespace xo*/ diff --git a/include/xo/unit/xquantity.hpp b/include/xo/unit/xquantity.hpp index 3d2606be..83f64d49 100644 --- a/include/xo/unit/xquantity.hpp +++ b/include/xo/unit/xquantity.hpp @@ -331,16 +331,6 @@ namespace xo { return Quantity(x, nu::dimensionless) - y; } - /** note: won't have constexpr result until c++26 (when ::sqrt(), ::pow() are constexpr) - **/ - template - requires quantity2_concept && quantity2_concept - constexpr auto - operator== (const Quantity & x, const Quantity2 & y) - { - return (Quantity::compare(x, y) == 0); - } - /** note: won't have constexpr result until c++26 (when ::sqrt(), ::pow() are constexpr) **/ template @@ -361,16 +351,6 @@ namespace xo { return (Quantity(x, nu::dimensionless) == y); } - /** note: won't have constexpr result until c++26 (when ::sqrt(), ::pow() are constexpr) - **/ - template - requires quantity2_concept && quantity2_concept - constexpr auto - operator<=> (const Quantity & x, const Quantity2 & y) - { - return Quantity::compare(x, y); - } - /** note: won't have constexpr result until c++26 (when ::sqrt(), ::pow() are constexpr) **/ template