mirror of
https://github.com/mpusz/mp-units.git
synced 2025-07-29 18:07:16 +02:00
feat: 💥 variadic template versions of get_common_XXX()
removed (only 2-argument overloads used in practice)
This commit is contained in:
@ -1535,13 +1535,6 @@ template<QuantitySpec Q1, QuantitySpec Q2>
|
|||||||
// NOLINTEND(bugprone-branch-clone)
|
// NOLINTEND(bugprone-branch-clone)
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] consteval QuantitySpec auto get_common_quantity_spec(QuantitySpec auto q1, QuantitySpec auto q2,
|
|
||||||
QuantitySpec auto q3, QuantitySpec auto... rest)
|
|
||||||
requires requires { get_common_quantity_spec(get_common_quantity_spec(q1, q2), q3, rest...); }
|
|
||||||
{
|
|
||||||
return get_common_quantity_spec(get_common_quantity_spec(q1, q2), q3, rest...);
|
|
||||||
}
|
|
||||||
|
|
||||||
MP_UNITS_EXPORT_END
|
MP_UNITS_EXPORT_END
|
||||||
|
|
||||||
} // namespace mp_units
|
} // namespace mp_units
|
||||||
|
@ -268,30 +268,24 @@ template<Reference R, typename Q>
|
|||||||
// NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward)
|
// NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward)
|
||||||
constexpr auto operator/(R, Q&& q) = delete;
|
constexpr auto operator/(R, Q&& q) = delete;
|
||||||
|
|
||||||
[[nodiscard]] consteval AssociatedUnit auto get_common_reference(AssociatedUnit auto u1, AssociatedUnit auto u2,
|
[[nodiscard]] consteval AssociatedUnit auto get_common_reference(AssociatedUnit auto u1, AssociatedUnit auto u2)
|
||||||
AssociatedUnit auto... rest)
|
|
||||||
requires requires {
|
requires requires {
|
||||||
{
|
{ get_common_quantity_spec(get_quantity_spec(u1), get_quantity_spec(u2)) } -> QuantitySpec;
|
||||||
get_common_quantity_spec(get_quantity_spec(u1), get_quantity_spec(u2), get_quantity_spec(rest)...)
|
{ get_common_unit(u1, u2) } -> AssociatedUnit;
|
||||||
} -> QuantitySpec;
|
|
||||||
{ get_common_unit(u1, u2, rest...) } -> AssociatedUnit;
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
return get_common_unit(u1, u2, rest...);
|
return get_common_unit(u1, u2);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<Reference R1, Reference R2, Reference... Rest>
|
template<Reference R1, Reference R2>
|
||||||
[[nodiscard]] consteval Reference auto get_common_reference(R1 r1, R2 r2, Rest... rest)
|
[[nodiscard]] consteval Reference auto get_common_reference(R1 r1, R2 r2)
|
||||||
requires(!(AssociatedUnit<R1> && AssociatedUnit<R2> && (... && AssociatedUnit<Rest>))) && requires {
|
requires(!(AssociatedUnit<R1> && AssociatedUnit<R2>)) && requires {
|
||||||
{
|
{ get_common_quantity_spec(get_quantity_spec(r1), get_quantity_spec(r2)) } -> QuantitySpec;
|
||||||
get_common_quantity_spec(get_quantity_spec(r1), get_quantity_spec(r2), get_quantity_spec(rest)...)
|
{ get_common_unit(get_unit(r1), get_unit(r2)) } -> Unit;
|
||||||
} -> QuantitySpec;
|
|
||||||
{ get_common_unit(get_unit(r1), get_unit(r2), get_unit(rest)...) } -> Unit;
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
return detail::reference_t<get_common_quantity_spec(get_quantity_spec(R1{}), get_quantity_spec(R2{}),
|
return detail::reference_t<get_common_quantity_spec(get_quantity_spec(R1{}), get_quantity_spec(R2{})),
|
||||||
get_quantity_spec(rest)...),
|
get_common_unit(get_unit(R1{}), get_unit(R2{}))>{};
|
||||||
get_common_unit(get_unit(R1{}), get_unit(R2{}), get_unit(rest)...)>{};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MP_UNITS_EXPORT_END
|
MP_UNITS_EXPORT_END
|
||||||
|
@ -654,12 +654,6 @@ template<Unit U1, Unit U2>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] consteval Unit auto get_common_unit(Unit auto u1, Unit auto u2, Unit auto u3, Unit auto... rest)
|
|
||||||
requires requires { get_common_unit(get_common_unit(u1, u2), u3, rest...); }
|
|
||||||
{
|
|
||||||
return get_common_unit(get_common_unit(u1, u2), u3, rest...);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Puts a space ' ' sign before a unit symbol
|
* @brief Puts a space ' ' sign before a unit symbol
|
||||||
|
Reference in New Issue
Block a user