mirror of
https://github.com/mpusz/mp-units.git
synced 2025-07-30 18:37:15 +02:00
refactor: repeated concept checks removed from get_common_reference
This commit is contained in:
@ -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{}),
|
||||
|
Reference in New Issue
Block a user