From 3dd48ee1e754a7cdab298f0bcfdc42bc4bf450bb Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Wed, 17 Apr 2024 20:53:01 -0400 Subject: [PATCH] xo-unit: bugfix: fix static asserts on operator+= operator-= --- include/xo/unit/quantity.hpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/include/xo/unit/quantity.hpp b/include/xo/unit/quantity.hpp index 138565d1..c49ab4d5 100644 --- a/include/xo/unit/quantity.hpp +++ b/include/xo/unit/quantity.hpp @@ -406,13 +406,11 @@ namespace xo { * @pre @p y must have the same dimension as @c *this. * * @param y quantity to add - * @retval this quantity after adding y + * @return this quantity after adding y **/ template quantity & operator+=(Quantity2 y) { - static_assert(std::same_as< - typename unit_type::canon_type, - typename Quantity2::unit_type::canon_type >); + static_assert(same_dimension_v); /* relying on assignment that correctly converts-to-lhs-units */ quantity y2 = y; @@ -427,13 +425,11 @@ namespace xo { * @pre @p y must have the same dimensions as @c *this * * @param y quantity to subtract - * @retval this quantity after subtracting y + * @return this quantity after subtracting y **/ template quantity & operator-=(Quantity2 y) { - static_assert(std::same_as< - typename unit_type::canon_type, - typename Quantity2::unit_type::canon_type >); + static_assert(same_dimension_v); quantity y2 = y;