From 2d2211fffadec55302549dc17febbe3527b6b2a5 Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Thu, 18 May 2023 11:33:10 +0200 Subject: [PATCH] refactor: `UnitOf` used in `quantity_spec::operator[]` --- src/core/include/mp_units/quantity_spec.h | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/core/include/mp_units/quantity_spec.h b/src/core/include/mp_units/quantity_spec.h index d5ca2ae5..f6c9e664 100644 --- a/src/core/include/mp_units/quantity_spec.h +++ b/src/core/include/mp_units/quantity_spec.h @@ -97,9 +97,8 @@ template #endif struct quantity_spec_interface { #ifdef __cpp_explicit_this_parameter - template + template U> [[nodiscard]] consteval Reference auto operator[](this Self self, U u) const - requires(implicitly_convertible(self, detail::get_associated_quantity(u))) { return reference{}; } @@ -111,9 +110,8 @@ struct quantity_spec_interface { return std::forward(q).number() * reference::unit>{}; } #else - template + template U> [[nodiscard]] consteval Reference auto operator[](U u) const - requires(implicitly_convertible(Self{}, detail::get_associated_quantity(u))) { return reference{}; } @@ -287,9 +285,8 @@ struct quantity_spec : std::remove_const_t { static constexpr quantity_character character = detail::quantity_character_init(QS.character); #ifndef __cpp_explicit_this_parameter - template + template U> [[nodiscard]] consteval Reference auto operator[](U u) const - requires(implicitly_convertible(Self{}, detail::get_associated_quantity(u))) { return reference{}; }