Skip to content

Commit

Permalink
refactor: repeated concept checks removed from get_common_reference
Browse files Browse the repository at this point in the history
  • Loading branch information
mpusz committed Dec 1, 2024
1 parent e585fd9 commit c7006f8
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/core/include/mp-units/framework/reference.h
Original file line number Diff line number Diff line change
Expand Up @@ -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...);
Expand All @@ -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{}),
Expand Down

0 comments on commit c7006f8

Please sign in to comment.