forked from mpusz/mp-units
fix: has_associated_quantity
fixed
This commit is contained in:
@@ -140,12 +140,14 @@ template<typename... Us>
|
|||||||
template<Unit U>
|
template<Unit U>
|
||||||
[[nodiscard]] consteval bool has_associated_quantity(U)
|
[[nodiscard]] consteval bool has_associated_quantity(U)
|
||||||
{
|
{
|
||||||
|
if constexpr (requires { U::quantity_spec; })
|
||||||
|
return true;
|
||||||
if constexpr (requires { U::reference_unit; })
|
if constexpr (requires { U::reference_unit; })
|
||||||
return has_associated_quantity(U::reference_unit);
|
return has_associated_quantity(U::reference_unit);
|
||||||
else if constexpr (requires { typename U::_num_; })
|
else if constexpr (requires { typename U::_num_; })
|
||||||
return has_associated_quantity(typename U::_num_{}) && has_associated_quantity(typename U::_den_{});
|
return has_associated_quantity(typename U::_num_{}) && has_associated_quantity(typename U::_den_{});
|
||||||
else
|
else
|
||||||
return requires { U::base_quantity; };
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
Reference in New Issue
Block a user