style: pre-commit updated to clang-format-18.1.8

This commit is contained in:
Mateusz Pusz
2024-09-17 20:27:26 -06:00
parent 831c017a22
commit 089ce3f9d9
13 changed files with 50 additions and 101 deletions

View File

@ -10,24 +10,28 @@ AccessModifierOffset: -2
# AcrossEmptyLines: false # AcrossEmptyLines: false
# AcrossComments: false # AcrossComments: false
# AlignCompound: false # AlignCompound: false
# AlignFunctionPointers: false
# PadOperators: true # PadOperators: true
# AlignConsecutiveBitFields: # AlignConsecutiveBitFields:
# Enabled: false # Enabled: false
# AcrossEmptyLines: false # AcrossEmptyLines: false
# AcrossComments: false # AcrossComments: false
# AlignCompound: false # AlignCompound: false
# AlignFunctionPointers: false
# PadOperators: false # PadOperators: false
# AlignConsecutiveDeclarations: # AlignConsecutiveDeclarations:
# Enabled: false # Enabled: false
# AcrossEmptyLines: false # AcrossEmptyLines: false
# AcrossComments: false # AcrossComments: false
# AlignCompound: false # AlignCompound: false
# AlignFunctionPointers: false
# PadOperators: false # PadOperators: false
# AlignConsecutiveMacros: # AlignConsecutiveMacros:
# Enabled: false # Enabled: false
# AcrossEmptyLines: false # AcrossEmptyLines: false
# AcrossComments: false # AcrossComments: false
# AlignCompound: false # AlignCompound: false
# AlignFunctionPointers: false
# PadOperators: false # PadOperators: false
# AlignConsecutiveShortCaseStatements: # AlignConsecutiveShortCaseStatements:
# Enabled: false # Enabled: false
@ -41,8 +45,10 @@ AccessModifierOffset: -2
# OverEmptyLines: 0 # OverEmptyLines: 0
# AllowAllArgumentsOnNextLine: true # AllowAllArgumentsOnNextLine: true
# AllowAllParametersOfDeclarationOnNextLine: true # AllowAllParametersOfDeclarationOnNextLine: true
# AllowBreakBeforeNoexceptSpecifier: Never
# AllowShortBlocksOnASingleLine: Never # AllowShortBlocksOnASingleLine: Never
# AllowShortCaseLabelsOnASingleLine: false # AllowShortCaseLabelsOnASingleLine: false
# AllowShortCompoundRequirementOnASingleLine: true
# AllowShortEnumsOnASingleLine: true # AllowShortEnumsOnASingleLine: true
# AllowShortFunctionsOnASingleLine: All # AllowShortFunctionsOnASingleLine: All
# AllowShortIfStatementsOnASingleLine: WithoutElse # AllowShortIfStatementsOnASingleLine: WithoutElse
@ -76,7 +82,8 @@ BraceWrapping:
# SplitEmptyFunction: true # SplitEmptyFunction: true
SplitEmptyRecord: false SplitEmptyRecord: false
# SplitEmptyNamespace: true # SplitEmptyNamespace: true
# BreakAfterAttributes: Never # BreakAdjacentStringLiterals: true
# BreakAfterAttributes: Leave
# BreakAfterJavaFieldAnnotations: false # BreakAfterJavaFieldAnnotations: false
# BreakArrays: true # BreakArrays: true
# BreakBeforeBinaryOperators: None # BreakBeforeBinaryOperators: None
@ -160,6 +167,7 @@ MaxEmptyLinesToKeep: 2
# PenaltyBreakComment: 300 # PenaltyBreakComment: 300
# PenaltyBreakFirstLessLess: 120 # PenaltyBreakFirstLessLess: 120
# PenaltyBreakOpenParenthesis: 0 # PenaltyBreakOpenParenthesis: 0
# PenaltyBreakScopeResolution: 500
# PenaltyBreakString: 1000 # PenaltyBreakString: 1000
# PenaltyBreakTemplateDeclaration: 10 # PenaltyBreakTemplateDeclaration: 10
# PenaltyExcessCharacter: 1000000 # PenaltyExcessCharacter: 1000000
@ -207,6 +215,7 @@ QualifierAlignment: Left
# RequiresExpressionIndentation: OuterScope # RequiresExpressionIndentation: OuterScope
# SeparateDefinitionBlocks: Leave # SeparateDefinitionBlocks: Leave
# ShortNamespaceLines: 1 # ShortNamespaceLines: 1
# SkipMacroDefinitionBody: false
# SortIncludes: CaseSensitive # SortIncludes: CaseSensitive
# SortJavaStaticImport: Before # SortJavaStaticImport: Before
SortUsingDeclarations: false SortUsingDeclarations: false
@ -228,6 +237,7 @@ SpaceBeforeParensOptions:
# AfterFunctionDeclarationName: false # AfterFunctionDeclarationName: false
# AfterIfMacros: true # AfterIfMacros: true
# AfterOverloadedOperator: false # AfterOverloadedOperator: false
# AfterPlacementOperator: true
AfterRequiresInClause: true AfterRequiresInClause: true
# AfterRequiresInExpression: false # AfterRequiresInExpression: false
# BeforeNonEmptyParentheses: false # BeforeNonEmptyParentheses: false

View File

@ -11,7 +11,7 @@ repos:
- id: trailing-whitespace - id: trailing-whitespace
- id: end-of-file-fixer - id: end-of-file-fixer
- repo: https://github.com/pre-commit/mirrors-clang-format - repo: https://github.com/pre-commit/mirrors-clang-format
rev: v17.0.5 rev: v18.1.8
hooks: hooks:
- id: clang-format - id: clang-format
- repo: https://github.com/cheshirekow/cmake-format-precommit - repo: https://github.com/cheshirekow/cmake-format-precommit

View File

@ -38,9 +38,7 @@ namespace mp_units {
template<typename T> template<typename T>
requires requires { requires requires {
{ { T::zero() } -> std::equality_comparable_with<T>;
T::zero()
} -> std::equality_comparable_with<T>;
} }
[[nodiscard]] constexpr bool is_eq_zero(T v) [[nodiscard]] constexpr bool is_eq_zero(T v)
{ {
@ -49,9 +47,7 @@ template<typename T>
template<typename T> template<typename T>
requires requires { requires requires {
{ { T::zero() } -> std::equality_comparable_with<T>;
T::zero()
} -> std::equality_comparable_with<T>;
} }
[[nodiscard]] constexpr bool is_neq_zero(T v) [[nodiscard]] constexpr bool is_neq_zero(T v)
{ {
@ -60,9 +56,7 @@ template<typename T>
template<typename T> template<typename T>
requires requires { requires requires {
{ { T::zero() } -> std::three_way_comparable_with<T>;
T::zero()
} -> std::three_way_comparable_with<T>;
} }
[[nodiscard]] constexpr bool is_lt_zero(T v) [[nodiscard]] constexpr bool is_lt_zero(T v)
{ {
@ -71,9 +65,7 @@ template<typename T>
template<typename T> template<typename T>
requires requires { requires requires {
{ { T::zero() } -> std::three_way_comparable_with<T>;
T::zero()
} -> std::three_way_comparable_with<T>;
} }
[[nodiscard]] constexpr bool is_gt_zero(T v) [[nodiscard]] constexpr bool is_gt_zero(T v)
{ {
@ -82,9 +74,7 @@ template<typename T>
template<typename T> template<typename T>
requires requires { requires requires {
{ { T::zero() } -> std::three_way_comparable_with<T>;
T::zero()
} -> std::three_way_comparable_with<T>;
} }
[[nodiscard]] constexpr bool is_lteq_zero(T v) [[nodiscard]] constexpr bool is_lteq_zero(T v)
{ {
@ -93,9 +83,7 @@ template<typename T>
template<typename T> template<typename T>
requires requires { requires requires {
{ { T::zero() } -> std::three_way_comparable_with<T>;
T::zero()
} -> std::three_way_comparable_with<T>;
} }
[[nodiscard]] constexpr bool is_gteq_zero(T v) [[nodiscard]] constexpr bool is_gteq_zero(T v)
{ {

View File

@ -118,9 +118,7 @@ struct quantity_values {
static constexpr Rep min() noexcept static constexpr Rep min() noexcept
requires requires { requires requires {
{ { std::numeric_limits<Rep>::lowest() } -> std::same_as<Rep>;
std::numeric_limits<Rep>::lowest()
} -> std::same_as<Rep>;
} }
{ {
return std::numeric_limits<Rep>::lowest(); return std::numeric_limits<Rep>::lowest();
@ -128,9 +126,7 @@ struct quantity_values {
static constexpr Rep max() noexcept static constexpr Rep max() noexcept
requires requires { requires requires {
{ { std::numeric_limits<Rep>::max() } -> std::same_as<Rep>;
std::numeric_limits<Rep>::max()
} -> std::same_as<Rep>;
} }
{ {
return std::numeric_limits<Rep>::max(); return std::numeric_limits<Rep>::max();

View File

@ -79,8 +79,7 @@ constexpr bool is_per_of_dims<per<Ts...>> =
(... && (BaseDimension<Ts> || is_dimension_one<Ts>::value || IsPowerOfDim<Ts>)); (... && (BaseDimension<Ts> || is_dimension_one<Ts>::value || IsPowerOfDim<Ts>));
template<typename T> template<typename T>
concept DerivedDimensionExpr = concept DerivedDimensionExpr = BaseDimension<T> || is_dimension_one<T>::value || IsPowerOfDim<T> || is_per_of_dims<T>;
BaseDimension<T> || is_dimension_one<T>::value || IsPowerOfDim<T> || is_per_of_dims<T>;
template<auto D1, auto D2> template<auto D1, auto D2>
concept SameDimension = concept SameDimension =

View File

@ -64,9 +64,7 @@ concept IsFloatingPoint = treat_as_floating_point<T>;
template<typename FromRep, typename ToRep, auto FromUnit = one, auto ToUnit = one> template<typename FromRep, typename ToRep, auto FromUnit = one, auto ToUnit = one>
concept ValuePreservingTo = requires(FromRep&& from, ToRep to) { concept ValuePreservingTo = requires(FromRep&& from, ToRep to) {
{ { to = std::forward<FromRep>(from) } -> std::same_as<ToRep&>;
to = std::forward<FromRep>(from)
} -> std::same_as<ToRep&>;
} && (IsFloatingPoint<ToRep> || (!IsFloatingPoint<FromRep> && (integral_conversion_factor(FromUnit, ToUnit)))); } && (IsFloatingPoint<ToRep> || (!IsFloatingPoint<FromRep> && (integral_conversion_factor(FromUnit, ToUnit))));
template<typename QFrom, typename QTo> template<typename QFrom, typename QTo>
@ -325,9 +323,7 @@ public:
// member unary operators // member unary operators
[[nodiscard]] constexpr QuantityOf<quantity_spec> auto operator+() const [[nodiscard]] constexpr QuantityOf<quantity_spec> auto operator+() const
requires requires(rep v) { requires requires(rep v) {
{ { +v } -> std::common_with<rep>;
+v
} -> std::common_with<rep>;
} }
{ {
return ::mp_units::quantity{+numerical_value_is_an_implementation_detail_, reference}; return ::mp_units::quantity{+numerical_value_is_an_implementation_detail_, reference};
@ -335,9 +331,7 @@ public:
[[nodiscard]] constexpr QuantityOf<quantity_spec> auto operator-() const [[nodiscard]] constexpr QuantityOf<quantity_spec> auto operator-() const
requires requires(rep v) { requires requires(rep v) {
{ { -v } -> std::common_with<rep>;
-v
} -> std::common_with<rep>;
} }
{ {
return ::mp_units::quantity{-numerical_value_is_an_implementation_detail_, reference}; return ::mp_units::quantity{-numerical_value_is_an_implementation_detail_, reference};
@ -346,9 +340,7 @@ public:
template<typename FwdQ, std::derived_from<quantity> Q = std::remove_cvref_t<FwdQ>> template<typename FwdQ, std::derived_from<quantity> Q = std::remove_cvref_t<FwdQ>>
friend constexpr decltype(auto) operator++(FwdQ&& q) friend constexpr decltype(auto) operator++(FwdQ&& q)
requires requires(rep v) { requires requires(rep v) {
{ { ++v } -> std::same_as<rep&>;
++v
} -> std::same_as<rep&>;
} }
{ {
++q.numerical_value_is_an_implementation_detail_; ++q.numerical_value_is_an_implementation_detail_;
@ -357,9 +349,7 @@ public:
[[nodiscard]] constexpr QuantityOf<quantity_spec> auto operator++(int) [[nodiscard]] constexpr QuantityOf<quantity_spec> auto operator++(int)
requires requires(rep v) { requires requires(rep v) {
{ { v++ } -> std::common_with<rep>;
v++
} -> std::common_with<rep>;
} }
{ {
return ::mp_units::quantity{numerical_value_is_an_implementation_detail_++, reference}; return ::mp_units::quantity{numerical_value_is_an_implementation_detail_++, reference};
@ -368,9 +358,7 @@ public:
template<typename FwdQ, std::derived_from<quantity> Q = std::remove_cvref_t<FwdQ>> template<typename FwdQ, std::derived_from<quantity> Q = std::remove_cvref_t<FwdQ>>
friend constexpr decltype(auto) operator--(FwdQ&& q) friend constexpr decltype(auto) operator--(FwdQ&& q)
requires requires(rep v) { requires requires(rep v) {
{ { --v } -> std::same_as<rep&>;
--v
} -> std::same_as<rep&>;
} }
{ {
--q.numerical_value_is_an_implementation_detail_; --q.numerical_value_is_an_implementation_detail_;
@ -379,9 +367,7 @@ public:
[[nodiscard]] constexpr QuantityOf<quantity_spec> auto operator--(int) [[nodiscard]] constexpr QuantityOf<quantity_spec> auto operator--(int)
requires requires(rep v) { requires requires(rep v) {
{ { v-- } -> std::common_with<rep>;
v--
} -> std::common_with<rep>;
} }
{ {
return ::mp_units::quantity{numerical_value_is_an_implementation_detail_--, reference}; return ::mp_units::quantity{numerical_value_is_an_implementation_detail_--, reference};
@ -390,9 +376,7 @@ public:
// compound assignment operators // compound assignment operators
template<typename FwdQ, std::derived_from<quantity> Q = std::remove_cvref_t<FwdQ>> template<typename FwdQ, std::derived_from<quantity> Q = std::remove_cvref_t<FwdQ>>
requires requires(rep a, rep b) { requires requires(rep a, rep b) {
{ { a += b } -> std::same_as<rep&>;
a += b
} -> std::same_as<rep&>;
} }
friend constexpr decltype(auto) operator+=(FwdQ&& lhs, const quantity& rhs) friend constexpr decltype(auto) operator+=(FwdQ&& lhs, const quantity& rhs)
{ {
@ -402,9 +386,7 @@ public:
template<typename FwdQ, std::derived_from<quantity> Q = std::remove_cvref_t<FwdQ>> template<typename FwdQ, std::derived_from<quantity> Q = std::remove_cvref_t<FwdQ>>
requires requires(rep a, rep b) { requires requires(rep a, rep b) {
{ { a -= b } -> std::same_as<rep&>;
a -= b
} -> std::same_as<rep&>;
} }
friend constexpr decltype(auto) operator-=(FwdQ&& lhs, const quantity& rhs) friend constexpr decltype(auto) operator-=(FwdQ&& lhs, const quantity& rhs)
{ {
@ -414,9 +396,7 @@ public:
template<typename FwdQ, std::derived_from<quantity> Q = std::remove_cvref_t<FwdQ>> template<typename FwdQ, std::derived_from<quantity> Q = std::remove_cvref_t<FwdQ>>
requires(!treat_as_floating_point<rep>) && requires(rep a, rep b) { requires(!treat_as_floating_point<rep>) && requires(rep a, rep b) {
{ { a %= b } -> std::same_as<rep&>;
a %= b
} -> std::same_as<rep&>;
} }
friend constexpr decltype(auto) operator%=(FwdQ&& lhs, const quantity& rhs) friend constexpr decltype(auto) operator%=(FwdQ&& lhs, const quantity& rhs)
@ -428,9 +408,7 @@ public:
template<typename FwdQ, typename Value, std::derived_from<quantity> Q = std::remove_cvref_t<FwdQ>> template<typename FwdQ, typename Value, std::derived_from<quantity> Q = std::remove_cvref_t<FwdQ>>
requires(!Quantity<Value>) && requires(rep a, const Value b) { requires(!Quantity<Value>) && requires(rep a, const Value b) {
{ { a *= b } -> std::same_as<rep&>;
a *= b
} -> std::same_as<rep&>;
} }
friend constexpr decltype(auto) operator*=(FwdQ&& lhs, const Value& v) friend constexpr decltype(auto) operator*=(FwdQ&& lhs, const Value& v)
{ {
@ -442,9 +420,7 @@ public:
template<typename FwdQ1, QuantityOf<dimensionless> Q2, std::derived_from<quantity> Q1 = std::remove_cvref_t<FwdQ1>> template<typename FwdQ1, QuantityOf<dimensionless> Q2, std::derived_from<quantity> Q1 = std::remove_cvref_t<FwdQ1>>
requires(Q2::unit == ::mp_units::one) && requires(rep a, const typename Q2::rep b) { requires(Q2::unit == ::mp_units::one) && requires(rep a, const typename Q2::rep b) {
{ { a *= b } -> std::same_as<rep&>;
a *= b
} -> std::same_as<rep&>;
} }
friend constexpr decltype(auto) operator*=(FwdQ1&& lhs, const Q2& rhs) friend constexpr decltype(auto) operator*=(FwdQ1&& lhs, const Q2& rhs)
{ {
@ -457,9 +433,7 @@ public:
template<typename FwdQ, typename Value, std::derived_from<quantity> Q = std::remove_cvref_t<FwdQ>> template<typename FwdQ, typename Value, std::derived_from<quantity> Q = std::remove_cvref_t<FwdQ>>
requires(!Quantity<Value>) && requires(rep a, const Value b) { requires(!Quantity<Value>) && requires(rep a, const Value b) {
{ { a /= b } -> std::same_as<rep&>;
a /= b
} -> std::same_as<rep&>;
} }
friend constexpr decltype(auto) operator/=(FwdQ&& lhs, const Value& v) friend constexpr decltype(auto) operator/=(FwdQ&& lhs, const Value& v)
{ {
@ -472,9 +446,7 @@ public:
template<typename FwdQ1, QuantityOf<dimensionless> Q2, std::derived_from<quantity> Q1 = std::remove_cvref_t<FwdQ1>> template<typename FwdQ1, QuantityOf<dimensionless> Q2, std::derived_from<quantity> Q1 = std::remove_cvref_t<FwdQ1>>
requires(Q2::unit == ::mp_units::one) && requires(rep a, const typename Q2::rep b) { requires(Q2::unit == ::mp_units::one) && requires(rep a, const typename Q2::rep b) {
{ { a /= b } -> std::same_as<rep&>;
a /= b
} -> std::same_as<rep&>;
} }
friend constexpr decltype(auto) operator/=(FwdQ1&& lhs, const Q2& rhs) friend constexpr decltype(auto) operator/=(FwdQ1&& lhs, const Q2& rhs)
{ {
@ -673,9 +645,7 @@ MP_UNITS_EXPORT_END
template<mp_units::Quantity Q1, mp_units::Quantity Q2> template<mp_units::Quantity Q1, mp_units::Quantity Q2>
requires requires { requires requires {
{ { mp_units::common_reference(Q1::reference, Q2::reference) } -> mp_units::Reference;
mp_units::common_reference(Q1::reference, Q2::reference)
} -> mp_units::Reference;
typename std::common_type_t<typename Q1::rep, typename Q2::rep>; typename std::common_type_t<typename Q1::rep, typename Q2::rep>;
} }
struct std::common_type<Q1, Q2> { struct std::common_type<Q1, Q2> {

View File

@ -78,12 +78,8 @@ concept QuantityLike = requires {
requires RepresentationOf<typename quantity_like_traits<T>::rep, requires RepresentationOf<typename quantity_like_traits<T>::rep,
get_quantity_spec(quantity_like_traits<T>::reference).character>; get_quantity_spec(quantity_like_traits<T>::reference).character>;
} && requires(T q, typename quantity_like_traits<T>::rep v) { } && requires(T q, typename quantity_like_traits<T>::rep v) {
{ { quantity_like_traits<T>::to_numerical_value(q) } -> detail::ConversionSpecOf<typename quantity_like_traits<T>::rep>;
quantity_like_traits<T>::to_numerical_value(q) { quantity_like_traits<T>::from_numerical_value(v) } -> detail::ConversionSpecOf<T>;
} -> detail::ConversionSpecOf<typename quantity_like_traits<T>::rep>;
{
quantity_like_traits<T>::from_numerical_value(v)
} -> detail::ConversionSpecOf<T>;
}; };
MP_UNITS_EXPORT_END MP_UNITS_EXPORT_END

View File

@ -161,9 +161,7 @@ concept QuantityPointLike = requires {
{ {
quantity_point_like_traits<T>::to_numerical_value(qp) quantity_point_like_traits<T>::to_numerical_value(qp)
} -> detail::ConversionSpecOf<typename quantity_point_like_traits<T>::rep>; } -> detail::ConversionSpecOf<typename quantity_point_like_traits<T>::rep>;
{ { quantity_point_like_traits<T>::from_numerical_value(v) } -> detail::ConversionSpecOf<T>;
quantity_point_like_traits<T>::from_numerical_value(v)
} -> detail::ConversionSpecOf<T>;
}; };
} // namespace mp_units } // namespace mp_units

View File

@ -684,7 +684,7 @@ struct ingredients_less :
std::bool_constant<(lhs_compl > rhs_compl) || std::bool_constant<(lhs_compl > rhs_compl) ||
(lhs_compl == rhs_compl && ingredients_dimension_less(Lhs::dimension, Rhs::dimension)) || (lhs_compl == rhs_compl && ingredients_dimension_less(Lhs::dimension, Rhs::dimension)) ||
(lhs_compl == rhs_compl && Lhs::dimension == Rhs::dimension && (lhs_compl == rhs_compl && Lhs::dimension == Rhs::dimension &&
detail::type_name<Lhs>() < detail::type_name<Rhs>())> {}; detail::type_name<Lhs>() < detail::type_name<Rhs>())>{};
template<typename T1, typename T2> template<typename T1, typename T2>
using type_list_of_ingredients_less = expr_less<T1, T2, ingredients_less>; using type_list_of_ingredients_less = expr_less<T1, T2, ingredients_less>;

View File

@ -86,8 +86,8 @@ template<typename T>
struct is_dimensionless : std::false_type {}; struct is_dimensionless : std::false_type {};
template<typename T> template<typename T>
concept IsPowerOfQuantitySpec = is_specialization_of_power<T> && (NamedQuantitySpec<typename T::factor> || concept IsPowerOfQuantitySpec = is_specialization_of_power<T> &&
is_dimensionless<typename T::factor>::value); (NamedQuantitySpec<typename T::factor> || is_dimensionless<typename T::factor>::value);
template<typename T> template<typename T>
@ -142,8 +142,8 @@ concept ChildQuantitySpecOf = (is_child_of(Child, Parent));
template<auto To, auto From> template<auto To, auto From>
concept NestedQuantityKindSpecOf = concept NestedQuantityKindSpecOf =
QuantitySpec<decltype(From)> && QuantitySpec<decltype(To)> && QuantitySpec<decltype(From)> && QuantitySpec<decltype(To)> && (!SameQuantitySpec<get_kind(From), get_kind(To)>) &&
(!SameQuantitySpec<get_kind(From), get_kind(To)>)&&ChildQuantitySpecOf<To, get_kind(From)._quantity_spec_>; ChildQuantitySpecOf<To, get_kind(From)._quantity_spec_>;
template<auto From, auto To> template<auto From, auto To>
concept QuantitySpecConvertibleTo = concept QuantitySpecConvertibleTo =

View File

@ -271,12 +271,8 @@ constexpr auto operator/(R, Q&& q) = delete;
[[nodiscard]] consteval AssociatedUnit auto common_reference(AssociatedUnit auto u1, AssociatedUnit auto u2, [[nodiscard]] consteval AssociatedUnit auto common_reference(AssociatedUnit auto u1, AssociatedUnit auto u2,
AssociatedUnit auto... rest) AssociatedUnit auto... rest)
requires requires { requires requires {
{ { common_quantity_spec(get_quantity_spec(u1), get_quantity_spec(u2), get_quantity_spec(rest)...) } -> QuantitySpec;
common_quantity_spec(get_quantity_spec(u1), get_quantity_spec(u2), get_quantity_spec(rest)...) { common_unit(u1, u2, rest...) } -> AssociatedUnit;
} -> QuantitySpec;
{
common_unit(u1, u2, rest...)
} -> AssociatedUnit;
} }
{ {
return common_unit(u1, u2, rest...); return common_unit(u1, u2, rest...);
@ -285,12 +281,8 @@ constexpr auto operator/(R, Q&& q) = delete;
template<Reference R1, Reference R2, Reference... Rest> template<Reference R1, Reference R2, Reference... Rest>
[[nodiscard]] consteval Reference auto common_reference(R1 r1, R2 r2, Rest... rest) [[nodiscard]] consteval Reference auto common_reference(R1 r1, R2 r2, Rest... rest)
requires(!(AssociatedUnit<R1> && AssociatedUnit<R2> && (... && AssociatedUnit<Rest>))) && requires { requires(!(AssociatedUnit<R1> && AssociatedUnit<R2> && (... && AssociatedUnit<Rest>))) && requires {
{ { common_quantity_spec(get_quantity_spec(r1), get_quantity_spec(r2), get_quantity_spec(rest)...) } -> QuantitySpec;
common_quantity_spec(get_quantity_spec(r1), get_quantity_spec(r2), get_quantity_spec(rest)...) { common_unit(get_unit(r1), get_unit(r2), get_unit(rest)...) } -> Unit;
} -> QuantitySpec;
{
common_unit(get_unit(r1), get_unit(r2), get_unit(rest)...)
} -> Unit;
} }
{ {
return detail::reference_t<common_quantity_spec(get_quantity_spec(R1{}), get_quantity_spec(R2{}), return detail::reference_t<common_quantity_spec(get_quantity_spec(R1{}), get_quantity_spec(R2{}),

View File

@ -86,7 +86,7 @@ concept WeaklyRegular = std::copyable<T> && std::equality_comparable<T>;
MP_UNITS_EXPORT template<typename T> MP_UNITS_EXPORT template<typename T>
concept Representation = concept Representation =
(is_scalar<T> || is_vector<T> || is_tensor<T>)&&detail::WeaklyRegular<T> && detail::Scalable<T>; (is_scalar<T> || is_vector<T> || is_tensor<T>) && detail::WeaklyRegular<T> && detail::Scalable<T>;
MP_UNITS_EXPORT template<typename T, quantity_character Ch> MP_UNITS_EXPORT template<typename T, quantity_character Ch>
concept RepresentationOf = Representation<T> && ((Ch == quantity_character::scalar && is_scalar<T>) || concept RepresentationOf = Representation<T> && ((Ch == quantity_character::scalar && is_scalar<T>) ||

View File

@ -161,7 +161,7 @@ concept UnitConvertibleTo =
MP_UNITS_EXPORT template<typename U, auto FromU, auto QS> MP_UNITS_EXPORT template<typename U, auto FromU, auto QS>
concept UnitCompatibleWith = concept UnitCompatibleWith =
Unit<U> && Unit<MP_UNITS_REMOVE_CONST(decltype(FromU))> && QuantitySpec<MP_UNITS_REMOVE_CONST(decltype(QS))> && Unit<U> && Unit<MP_UNITS_REMOVE_CONST(decltype(FromU))> && QuantitySpec<MP_UNITS_REMOVE_CONST(decltype(QS))> &&
(!AssociatedUnit<U> || UnitOf<U, QS>)&&detail::UnitConvertibleTo<FromU, U{}>; (!AssociatedUnit<U> || UnitOf<U, QS>) && detail::UnitConvertibleTo<FromU, U{}>;
template<typename T> template<typename T>
concept OffsetUnit = Unit<T> && requires { T::point_origin; }; concept OffsetUnit = Unit<T> && requires { T::point_origin; };