Skip to content

Commit

Permalink
fix: QuantityLike conversions required Q::rep instead of using on…
Browse files Browse the repository at this point in the history
…e provided by `quantity_like_traits`
  • Loading branch information
mpusz committed Dec 18, 2023
1 parent 590d1fa commit bd9e4f9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/core/include/mp-units/quantity.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ class quantity {
quantity<quantity_like_traits<Q>::reference, typename quantity_like_traits<Q>::rep>, quantity>
constexpr explicit(is_specialization_of<decltype(quantity_like_traits<Q>::to_numerical_value(std::declval<Q>())),
convert_explicitly> ||
!std::convertible_to<typename Q::rep, Rep>) quantity(const Q& q) :
!std::convertible_to<typename quantity_like_traits<Q>::rep, Rep>) quantity(const Q& q) :
quantity(
::mp_units::quantity{quantity_like_traits<Q>::to_numerical_value(q).value, quantity_like_traits<Q>::reference})
{
Expand Down Expand Up @@ -222,7 +222,7 @@ class quantity {
[[nodiscard]] explicit(is_specialization_of<decltype(quantity_like_traits<Q>::from_numerical_value(
numerical_value_is_an_implementation_detail_)),
convert_explicitly> ||
!std::convertible_to<Rep, typename Q::rep>) constexpr
!std::convertible_to<Rep, typename quantity_like_traits<Q>::rep>) constexpr
operator Q_() const& noexcept(
noexcept(quantity_like_traits<Q>::from_numerical_value(numerical_value_is_an_implementation_detail_)) &&
std::is_nothrow_copy_constructible_v<rep>)
Expand All @@ -236,7 +236,7 @@ class quantity {
[[nodiscard]] explicit(is_specialization_of<decltype(quantity_like_traits<Q>::from_numerical_value(
numerical_value_is_an_implementation_detail_)),
convert_explicitly> ||
!std::convertible_to<Rep, typename Q::rep>) constexpr
!std::convertible_to<Rep, typename quantity_like_traits<Q>::rep>) constexpr
operator Q_() && noexcept(
noexcept(quantity_like_traits<Q>::from_numerical_value(numerical_value_is_an_implementation_detail_)) &&
std::is_nothrow_move_constructible_v<rep>)
Expand Down

0 comments on commit bd9e4f9

Please sign in to comment.