mirror of
https://github.com/mpusz/mp-units.git
synced 2025-06-24 08:41:34 +02:00
style: pre-commit updated to clang-format-18.1.8
This commit is contained in:
@ -10,24 +10,28 @@ AccessModifierOffset: -2
|
||||
# AcrossEmptyLines: false
|
||||
# AcrossComments: false
|
||||
# AlignCompound: false
|
||||
# AlignFunctionPointers: false
|
||||
# PadOperators: true
|
||||
# AlignConsecutiveBitFields:
|
||||
# Enabled: false
|
||||
# AcrossEmptyLines: false
|
||||
# AcrossComments: false
|
||||
# AlignCompound: false
|
||||
# AlignFunctionPointers: false
|
||||
# PadOperators: false
|
||||
# AlignConsecutiveDeclarations:
|
||||
# Enabled: false
|
||||
# AcrossEmptyLines: false
|
||||
# AcrossComments: false
|
||||
# AlignCompound: false
|
||||
# AlignFunctionPointers: false
|
||||
# PadOperators: false
|
||||
# AlignConsecutiveMacros:
|
||||
# Enabled: false
|
||||
# AcrossEmptyLines: false
|
||||
# AcrossComments: false
|
||||
# AlignCompound: false
|
||||
# AlignFunctionPointers: false
|
||||
# PadOperators: false
|
||||
# AlignConsecutiveShortCaseStatements:
|
||||
# Enabled: false
|
||||
@ -41,8 +45,10 @@ AccessModifierOffset: -2
|
||||
# OverEmptyLines: 0
|
||||
# AllowAllArgumentsOnNextLine: true
|
||||
# AllowAllParametersOfDeclarationOnNextLine: true
|
||||
# AllowBreakBeforeNoexceptSpecifier: Never
|
||||
# AllowShortBlocksOnASingleLine: Never
|
||||
# AllowShortCaseLabelsOnASingleLine: false
|
||||
# AllowShortCompoundRequirementOnASingleLine: true
|
||||
# AllowShortEnumsOnASingleLine: true
|
||||
# AllowShortFunctionsOnASingleLine: All
|
||||
# AllowShortIfStatementsOnASingleLine: WithoutElse
|
||||
@ -76,7 +82,8 @@ BraceWrapping:
|
||||
# SplitEmptyFunction: true
|
||||
SplitEmptyRecord: false
|
||||
# SplitEmptyNamespace: true
|
||||
# BreakAfterAttributes: Never
|
||||
# BreakAdjacentStringLiterals: true
|
||||
# BreakAfterAttributes: Leave
|
||||
# BreakAfterJavaFieldAnnotations: false
|
||||
# BreakArrays: true
|
||||
# BreakBeforeBinaryOperators: None
|
||||
@ -160,6 +167,7 @@ MaxEmptyLinesToKeep: 2
|
||||
# PenaltyBreakComment: 300
|
||||
# PenaltyBreakFirstLessLess: 120
|
||||
# PenaltyBreakOpenParenthesis: 0
|
||||
# PenaltyBreakScopeResolution: 500
|
||||
# PenaltyBreakString: 1000
|
||||
# PenaltyBreakTemplateDeclaration: 10
|
||||
# PenaltyExcessCharacter: 1000000
|
||||
@ -207,6 +215,7 @@ QualifierAlignment: Left
|
||||
# RequiresExpressionIndentation: OuterScope
|
||||
# SeparateDefinitionBlocks: Leave
|
||||
# ShortNamespaceLines: 1
|
||||
# SkipMacroDefinitionBody: false
|
||||
# SortIncludes: CaseSensitive
|
||||
# SortJavaStaticImport: Before
|
||||
SortUsingDeclarations: false
|
||||
@ -228,6 +237,7 @@ SpaceBeforeParensOptions:
|
||||
# AfterFunctionDeclarationName: false
|
||||
# AfterIfMacros: true
|
||||
# AfterOverloadedOperator: false
|
||||
# AfterPlacementOperator: true
|
||||
AfterRequiresInClause: true
|
||||
# AfterRequiresInExpression: false
|
||||
# BeforeNonEmptyParentheses: false
|
||||
|
@ -11,7 +11,7 @@ repos:
|
||||
- id: trailing-whitespace
|
||||
- id: end-of-file-fixer
|
||||
- repo: https://github.com/pre-commit/mirrors-clang-format
|
||||
rev: v17.0.5
|
||||
rev: v18.1.8
|
||||
hooks:
|
||||
- id: clang-format
|
||||
- repo: https://github.com/cheshirekow/cmake-format-precommit
|
||||
|
@ -38,9 +38,7 @@ namespace mp_units {
|
||||
|
||||
template<typename T>
|
||||
requires requires {
|
||||
{
|
||||
T::zero()
|
||||
} -> std::equality_comparable_with<T>;
|
||||
{ T::zero() } -> std::equality_comparable_with<T>;
|
||||
}
|
||||
[[nodiscard]] constexpr bool is_eq_zero(T v)
|
||||
{
|
||||
@ -49,9 +47,7 @@ template<typename T>
|
||||
|
||||
template<typename T>
|
||||
requires requires {
|
||||
{
|
||||
T::zero()
|
||||
} -> std::equality_comparable_with<T>;
|
||||
{ T::zero() } -> std::equality_comparable_with<T>;
|
||||
}
|
||||
[[nodiscard]] constexpr bool is_neq_zero(T v)
|
||||
{
|
||||
@ -60,9 +56,7 @@ template<typename T>
|
||||
|
||||
template<typename T>
|
||||
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)
|
||||
{
|
||||
@ -71,9 +65,7 @@ template<typename T>
|
||||
|
||||
template<typename T>
|
||||
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)
|
||||
{
|
||||
@ -82,9 +74,7 @@ template<typename T>
|
||||
|
||||
template<typename T>
|
||||
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)
|
||||
{
|
||||
@ -93,9 +83,7 @@ template<typename T>
|
||||
|
||||
template<typename T>
|
||||
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)
|
||||
{
|
||||
|
@ -118,9 +118,7 @@ struct quantity_values {
|
||||
|
||||
static constexpr Rep min() noexcept
|
||||
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();
|
||||
@ -128,9 +126,7 @@ struct quantity_values {
|
||||
|
||||
static constexpr Rep max() noexcept
|
||||
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();
|
||||
|
@ -79,8 +79,7 @@ constexpr bool is_per_of_dims<per<Ts...>> =
|
||||
(... && (BaseDimension<Ts> || is_dimension_one<Ts>::value || IsPowerOfDim<Ts>));
|
||||
|
||||
template<typename T>
|
||||
concept DerivedDimensionExpr =
|
||||
BaseDimension<T> || is_dimension_one<T>::value || IsPowerOfDim<T> || is_per_of_dims<T>;
|
||||
concept DerivedDimensionExpr = BaseDimension<T> || is_dimension_one<T>::value || IsPowerOfDim<T> || is_per_of_dims<T>;
|
||||
|
||||
template<auto D1, auto D2>
|
||||
concept SameDimension =
|
||||
|
@ -64,9 +64,7 @@ concept IsFloatingPoint = treat_as_floating_point<T>;
|
||||
|
||||
template<typename FromRep, typename ToRep, auto FromUnit = one, auto ToUnit = one>
|
||||
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))));
|
||||
|
||||
template<typename QFrom, typename QTo>
|
||||
@ -325,9 +323,7 @@ public:
|
||||
// member unary operators
|
||||
[[nodiscard]] constexpr QuantityOf<quantity_spec> auto operator+() const
|
||||
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};
|
||||
@ -335,9 +331,7 @@ public:
|
||||
|
||||
[[nodiscard]] constexpr QuantityOf<quantity_spec> auto operator-() const
|
||||
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};
|
||||
@ -346,9 +340,7 @@ public:
|
||||
template<typename FwdQ, std::derived_from<quantity> Q = std::remove_cvref_t<FwdQ>>
|
||||
friend constexpr decltype(auto) operator++(FwdQ&& q)
|
||||
requires requires(rep v) {
|
||||
{
|
||||
++v
|
||||
} -> std::same_as<rep&>;
|
||||
{ ++v } -> std::same_as<rep&>;
|
||||
}
|
||||
{
|
||||
++q.numerical_value_is_an_implementation_detail_;
|
||||
@ -357,9 +349,7 @@ public:
|
||||
|
||||
[[nodiscard]] constexpr QuantityOf<quantity_spec> auto operator++(int)
|
||||
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};
|
||||
@ -368,9 +358,7 @@ public:
|
||||
template<typename FwdQ, std::derived_from<quantity> Q = std::remove_cvref_t<FwdQ>>
|
||||
friend constexpr decltype(auto) operator--(FwdQ&& q)
|
||||
requires requires(rep v) {
|
||||
{
|
||||
--v
|
||||
} -> std::same_as<rep&>;
|
||||
{ --v } -> std::same_as<rep&>;
|
||||
}
|
||||
{
|
||||
--q.numerical_value_is_an_implementation_detail_;
|
||||
@ -379,9 +367,7 @@ public:
|
||||
|
||||
[[nodiscard]] constexpr QuantityOf<quantity_spec> auto operator--(int)
|
||||
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};
|
||||
@ -390,9 +376,7 @@ public:
|
||||
// compound assignment operators
|
||||
template<typename FwdQ, std::derived_from<quantity> Q = std::remove_cvref_t<FwdQ>>
|
||||
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)
|
||||
{
|
||||
@ -402,9 +386,7 @@ public:
|
||||
|
||||
template<typename FwdQ, std::derived_from<quantity> Q = std::remove_cvref_t<FwdQ>>
|
||||
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)
|
||||
{
|
||||
@ -414,9 +396,7 @@ public:
|
||||
|
||||
template<typename FwdQ, std::derived_from<quantity> Q = std::remove_cvref_t<FwdQ>>
|
||||
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)
|
||||
|
||||
@ -428,9 +408,7 @@ public:
|
||||
|
||||
template<typename FwdQ, typename Value, std::derived_from<quantity> Q = std::remove_cvref_t<FwdQ>>
|
||||
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)
|
||||
{
|
||||
@ -442,9 +420,7 @@ public:
|
||||
|
||||
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) {
|
||||
{
|
||||
a *= b
|
||||
} -> std::same_as<rep&>;
|
||||
{ a *= b } -> std::same_as<rep&>;
|
||||
}
|
||||
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>>
|
||||
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)
|
||||
{
|
||||
@ -472,9 +446,7 @@ public:
|
||||
|
||||
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) {
|
||||
{
|
||||
a /= b
|
||||
} -> std::same_as<rep&>;
|
||||
{ a /= b } -> std::same_as<rep&>;
|
||||
}
|
||||
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>
|
||||
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>;
|
||||
}
|
||||
struct std::common_type<Q1, Q2> {
|
||||
|
@ -78,12 +78,8 @@ concept QuantityLike = requires {
|
||||
requires RepresentationOf<typename quantity_like_traits<T>::rep,
|
||||
get_quantity_spec(quantity_like_traits<T>::reference).character>;
|
||||
} && 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>::from_numerical_value(v)
|
||||
} -> detail::ConversionSpecOf<T>;
|
||||
{ quantity_like_traits<T>::to_numerical_value(q) } -> detail::ConversionSpecOf<typename quantity_like_traits<T>::rep>;
|
||||
{ quantity_like_traits<T>::from_numerical_value(v) } -> detail::ConversionSpecOf<T>;
|
||||
};
|
||||
|
||||
MP_UNITS_EXPORT_END
|
||||
|
@ -161,9 +161,7 @@ concept QuantityPointLike = requires {
|
||||
{
|
||||
quantity_point_like_traits<T>::to_numerical_value(qp)
|
||||
} -> 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
|
||||
|
@ -684,7 +684,7 @@ struct ingredients_less :
|
||||
std::bool_constant<(lhs_compl > rhs_compl) ||
|
||||
(lhs_compl == rhs_compl && ingredients_dimension_less(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>
|
||||
using type_list_of_ingredients_less = expr_less<T1, T2, ingredients_less>;
|
||||
|
@ -86,8 +86,8 @@ template<typename T>
|
||||
struct is_dimensionless : std::false_type {};
|
||||
|
||||
template<typename T>
|
||||
concept IsPowerOfQuantitySpec = is_specialization_of_power<T> && (NamedQuantitySpec<typename T::factor> ||
|
||||
is_dimensionless<typename T::factor>::value);
|
||||
concept IsPowerOfQuantitySpec = is_specialization_of_power<T> &&
|
||||
(NamedQuantitySpec<typename T::factor> || is_dimensionless<typename T::factor>::value);
|
||||
|
||||
|
||||
template<typename T>
|
||||
@ -142,8 +142,8 @@ concept ChildQuantitySpecOf = (is_child_of(Child, Parent));
|
||||
|
||||
template<auto To, auto From>
|
||||
concept NestedQuantityKindSpecOf =
|
||||
QuantitySpec<decltype(From)> && QuantitySpec<decltype(To)> &&
|
||||
(!SameQuantitySpec<get_kind(From), get_kind(To)>)&&ChildQuantitySpecOf<To, get_kind(From)._quantity_spec_>;
|
||||
QuantitySpec<decltype(From)> && QuantitySpec<decltype(To)> && (!SameQuantitySpec<get_kind(From), get_kind(To)>) &&
|
||||
ChildQuantitySpecOf<To, get_kind(From)._quantity_spec_>;
|
||||
|
||||
template<auto From, auto To>
|
||||
concept QuantitySpecConvertibleTo =
|
||||
|
@ -271,12 +271,8 @@ constexpr auto operator/(R, Q&& q) = delete;
|
||||
[[nodiscard]] consteval AssociatedUnit auto common_reference(AssociatedUnit auto u1, AssociatedUnit auto u2,
|
||||
AssociatedUnit auto... rest)
|
||||
requires requires {
|
||||
{
|
||||
common_quantity_spec(get_quantity_spec(u1), get_quantity_spec(u2), get_quantity_spec(rest)...)
|
||||
} -> QuantitySpec;
|
||||
{
|
||||
common_unit(u1, u2, rest...)
|
||||
} -> AssociatedUnit;
|
||||
{ common_quantity_spec(get_quantity_spec(u1), get_quantity_spec(u2), get_quantity_spec(rest)...) } -> QuantitySpec;
|
||||
{ common_unit(u1, u2, rest...) } -> AssociatedUnit;
|
||||
}
|
||||
{
|
||||
return common_unit(u1, u2, rest...);
|
||||
@ -285,12 +281,8 @@ constexpr auto operator/(R, Q&& q) = delete;
|
||||
template<Reference R1, Reference R2, Reference... Rest>
|
||||
[[nodiscard]] consteval Reference auto common_reference(R1 r1, R2 r2, Rest... rest)
|
||||
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_unit(get_unit(r1), get_unit(r2), get_unit(rest)...)
|
||||
} -> Unit;
|
||||
{ common_quantity_spec(get_quantity_spec(r1), get_quantity_spec(r2), get_quantity_spec(rest)...) } -> 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{}),
|
||||
|
@ -86,7 +86,7 @@ concept WeaklyRegular = std::copyable<T> && std::equality_comparable<T>;
|
||||
|
||||
MP_UNITS_EXPORT template<typename T>
|
||||
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>
|
||||
concept RepresentationOf = Representation<T> && ((Ch == quantity_character::scalar && is_scalar<T>) ||
|
||||
|
@ -161,7 +161,7 @@ concept UnitConvertibleTo =
|
||||
MP_UNITS_EXPORT template<typename U, auto FromU, auto QS>
|
||||
concept UnitCompatibleWith =
|
||||
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>
|
||||
concept OffsetUnit = Unit<T> && requires { T::point_origin; };
|
||||
|
Reference in New Issue
Block a user