mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-03 12:24:26 +02:00
refactor: interconvertible
renamed to convertible_to
This commit is contained in:
@@ -44,7 +44,7 @@ class quantity;
|
||||
* @tparam ToU a unit to use for a target quantity
|
||||
*/
|
||||
template<Unit auto ToU, auto R, typename Rep>
|
||||
requires(interconvertible(ToU, get_unit(R)))
|
||||
requires(convertible_to(get_unit(R), ToU))
|
||||
[[nodiscard]] constexpr Quantity auto value_cast(const quantity<R, Rep>& q)
|
||||
{
|
||||
if constexpr (detail::is_specialization_of_reference<R> || !AssociatedUnit<std::remove_const_t<decltype(ToU)>>) {
|
||||
|
@@ -130,21 +130,21 @@ template<Reference R, typename Rep>
|
||||
void /*Use `q * (1 * r)` rather than `q * r`.*/ operator*(Quantity auto, Reference auto) = delete;
|
||||
|
||||
template<auto Q1, auto U1, auto Q2, auto U2>
|
||||
[[nodiscard]] consteval bool interconvertible(reference<Q1, U1>, reference<Q2, U2>)
|
||||
[[nodiscard]] consteval bool convertible_to(reference<Q1, U1>, reference<Q2, U2>)
|
||||
{
|
||||
return interconvertible(Q1, Q2) && interconvertible(U1, U2);
|
||||
return convertible_to(Q1, Q2) && convertible_to(U1, U2);
|
||||
}
|
||||
|
||||
template<auto Q1, auto U1, AssociatedUnit U2>
|
||||
[[nodiscard]] consteval bool interconvertible(reference<Q1, U1>, U2 u2)
|
||||
[[nodiscard]] consteval bool convertible_to(reference<Q1, U1>, U2 u2)
|
||||
{
|
||||
return interconvertible(Q1, get_quantity_spec(u2)) && interconvertible(U1, u2);
|
||||
return convertible_to(Q1, get_quantity_spec(u2)) && convertible_to(U1, u2);
|
||||
}
|
||||
|
||||
template<AssociatedUnit U1, auto Q2, auto U2>
|
||||
[[nodiscard]] consteval bool interconvertible(U1 u1, reference<Q2, U2> r2)
|
||||
[[nodiscard]] consteval bool convertible_to(U1 u1, reference<Q2, U2>)
|
||||
{
|
||||
return interconvertible(r2, u1);
|
||||
return convertible_to(get_quantity_spec(u1), Q2) && convertible_to(u1, U2);
|
||||
}
|
||||
|
||||
[[nodiscard]] consteval auto common_reference(AssociatedUnit auto u1, AssociatedUnit auto u2,
|
||||
|
@@ -62,7 +62,7 @@ struct system_reference {
|
||||
static constexpr auto coherent_unit = CoU;
|
||||
|
||||
template<Unit U>
|
||||
requires(interconvertible(coherent_unit, U{}))
|
||||
requires(convertible_to(coherent_unit, U{}))
|
||||
[[nodiscard]] constexpr reference<quantity_spec, U{}> operator[](U) const
|
||||
{
|
||||
return {};
|
||||
|
Reference in New Issue
Block a user