diff --git a/src/core/include/mp_units/quantity.h b/src/core/include/mp_units/quantity.h index 11700992..07267b79 100644 --- a/src/core/include/mp_units/quantity.h +++ b/src/core/include/mp_units/quantity.h @@ -139,18 +139,16 @@ public: quantity& operator=(quantity&&) = default; // data access -#ifdef __cpp_explicit_this_parameter - template - [[nodiscard]] constexpr auto&& number(this Self&& self) noexcept - { - return std::forward(self).number_; - } -#else - [[nodiscard]] constexpr rep& number() & noexcept { return number_; } [[nodiscard]] constexpr const rep& number() const& noexcept { return number_; } [[nodiscard]] constexpr rep&& number() && noexcept { return std::move(number_); } [[nodiscard]] constexpr const rep&& number() const&& noexcept { return std::move(number_); } -#endif + + template + requires requires(quantity q) { q[U{}]; } + [[nodiscard]] constexpr rep number_in(U) const noexcept + { + return (*this)[U{}].number(); + } template requires quantity_convertible_to_{}, Rep>>