refactor: repeated concept checks removed from get_common_reference

This commit is contained in:
Mateusz Pusz
2024-12-01 13:45:34 +01:00
parent e585fd9e37
commit c7006f8813

View File

@ -287,10 +287,8 @@ constexpr auto operator/(R, Q&& q) = delete;
[[nodiscard]] consteval AssociatedUnit auto get_common_reference(AssociatedUnit auto u1, AssociatedUnit auto u2,
AssociatedUnit auto... rest)
requires requires {
{
get_common_quantity_spec(get_quantity_spec(u1), get_quantity_spec(u2), get_quantity_spec(rest)...)
} -> QuantitySpec;
{ get_common_unit(u1, u2, rest...) } -> AssociatedUnit;
get_common_quantity_spec(get_quantity_spec(u1), get_quantity_spec(u2), get_quantity_spec(rest)...);
get_common_unit(u1, u2, rest...);
}
{
return get_common_unit(u1, u2, rest...);
@ -299,10 +297,8 @@ constexpr auto operator/(R, Q&& q) = delete;
template<Reference R1, Reference R2, Reference... Rest>
[[nodiscard]] consteval Reference auto get_common_reference(R1 r1, R2 r2, Rest... rest)
requires(!(AssociatedUnit<R1> && AssociatedUnit<R2> && (... && AssociatedUnit<Rest>))) && requires {
{
get_common_quantity_spec(get_quantity_spec(r1), get_quantity_spec(r2), get_quantity_spec(rest)...)
} -> QuantitySpec;
{ get_common_unit(get_unit(r1), get_unit(r2), get_unit(rest)...) } -> Unit;
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_unit(rest)...);
}
{
return detail::reference_t<get_common_quantity_spec(get_quantity_spec(R1{}), get_quantity_spec(R2{}),