mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-03 04:14:27 +02:00
[clang-format]
This commit is contained in:
@@ -151,7 +151,7 @@ void example()
|
|||||||
const auto acceleration = isq::acceleration(measurement{9.8, 0.1} * m / s2);
|
const auto acceleration = isq::acceleration(measurement{9.8, 0.1} * m / s2);
|
||||||
const auto time = measurement{1.2, 0.1} * s;
|
const auto time = measurement{1.2, 0.1} * s;
|
||||||
|
|
||||||
const QuantityOf<(isq::velocity)> auto velocity = acceleration * time;
|
const QuantityOf<isq::velocity> auto velocity = acceleration * time;
|
||||||
std::cout << acceleration << " * " << time << " = " << velocity << " = " << velocity.in(km / h) << '\n';
|
std::cout << acceleration << " * " << time << " = " << velocity << " = " << velocity.in(km / h) << '\n';
|
||||||
|
|
||||||
const auto length = measurement{123., 1.} * m;
|
const auto length = measurement{123., 1.} * m;
|
||||||
|
@@ -108,7 +108,7 @@ template<Quantity To, typename From>
|
|||||||
constexpr auto q_unit = std::remove_reference_t<From>::unit;
|
constexpr auto q_unit = std::remove_reference_t<From>::unit;
|
||||||
if constexpr (q_unit == To::unit) {
|
if constexpr (q_unit == To::unit) {
|
||||||
// no scaling of the number needed
|
// no scaling of the number needed
|
||||||
return {static_cast< To::rep>(std::forward<From>(q).numerical_value_is_an_implementation_detail_),
|
return {static_cast<To::rep>(std::forward<From>(q).numerical_value_is_an_implementation_detail_),
|
||||||
To::reference}; // this is the only (and recommended) way to do a truncating conversion on a number, so we
|
To::reference}; // this is the only (and recommended) way to do a truncating conversion on a number, so we
|
||||||
// are using static_cast to suppress all the compiler warnings on conversions
|
// are using static_cast to suppress all the compiler warnings on conversions
|
||||||
} else {
|
} else {
|
||||||
@@ -116,14 +116,13 @@ template<Quantity To, typename From>
|
|||||||
using traits = magnitude_conversion_traits<To, std::remove_reference_t<From>>;
|
using traits = magnitude_conversion_traits<To, std::remove_reference_t<From>>;
|
||||||
if constexpr (std::is_floating_point_v<typename traits::multiplier_type>) {
|
if constexpr (std::is_floating_point_v<typename traits::multiplier_type>) {
|
||||||
// this results in great assembly
|
// this results in great assembly
|
||||||
auto res = static_cast< To::rep>(
|
auto res = static_cast<To::rep>(static_cast<traits::c_type>(q.numerical_value_is_an_implementation_detail_) *
|
||||||
static_cast<traits::c_type>(q.numerical_value_is_an_implementation_detail_) * traits::ratio);
|
traits::ratio);
|
||||||
return {res, To::reference};
|
return {res, To::reference};
|
||||||
} else {
|
} else {
|
||||||
// this is slower but allows conversions like 2000 m -> 2 km without loosing data
|
// this is slower but allows conversions like 2000 m -> 2 km without loosing data
|
||||||
auto res = static_cast< To::rep>(
|
auto res = static_cast<To::rep>(static_cast<traits::c_type>(q.numerical_value_is_an_implementation_detail_) *
|
||||||
static_cast<traits::c_type>(q.numerical_value_is_an_implementation_detail_) * traits::num_mult /
|
traits::num_mult / traits::den_mult * traits::irr_mult);
|
||||||
traits::den_mult * traits::irr_mult);
|
|
||||||
return {res, To::reference};
|
return {res, To::reference};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -41,7 +41,8 @@ template<Reference R>
|
|||||||
struct delta_ {
|
struct delta_ {
|
||||||
template<typename Rep>
|
template<typename Rep>
|
||||||
requires RepresentationOf<std::remove_cvref_t<Rep>, get_quantity_spec(R{}).character>
|
requires RepresentationOf<std::remove_cvref_t<Rep>, get_quantity_spec(R{}).character>
|
||||||
[[nodiscard]] constexpr quantity< MP_UNITS_EXPRESSION_WORKAROUND(R{}), std::remove_cvref_t<Rep>> operator()(Rep&& lhs) const
|
[[nodiscard]] constexpr quantity<MP_UNITS_EXPRESSION_WORKAROUND(R{}), std::remove_cvref_t<Rep>> operator()(
|
||||||
|
Rep&& lhs) const
|
||||||
{
|
{
|
||||||
return quantity{std::forward<Rep>(lhs), R{}};
|
return quantity{std::forward<Rep>(lhs), R{}};
|
||||||
}
|
}
|
||||||
@@ -51,7 +52,8 @@ template<Reference R>
|
|||||||
struct absolute_ {
|
struct absolute_ {
|
||||||
template<typename Rep>
|
template<typename Rep>
|
||||||
requires RepresentationOf<std::remove_cvref_t<Rep>, get_quantity_spec(R{}).character>
|
requires RepresentationOf<std::remove_cvref_t<Rep>, get_quantity_spec(R{}).character>
|
||||||
[[nodiscard]] constexpr quantity_point< MP_UNITS_EXPRESSION_WORKAROUND(R{}), default_point_origin(R{}), std::remove_cvref_t<Rep>>
|
[[nodiscard]] constexpr quantity_point<MP_UNITS_EXPRESSION_WORKAROUND(R{}), default_point_origin(R{}),
|
||||||
|
std::remove_cvref_t<Rep>>
|
||||||
operator()(Rep&& lhs) const
|
operator()(Rep&& lhs) const
|
||||||
{
|
{
|
||||||
return quantity_point{quantity{std::forward<Rep>(lhs), R{}}};
|
return quantity_point{quantity{std::forward<Rep>(lhs), R{}}};
|
||||||
|
@@ -188,8 +188,7 @@ struct expr_consolidate_impl<type_list<T, T, Rest...>> {
|
|||||||
// replaces the instance of a type and a power of it with one with incremented power
|
// replaces the instance of a type and a power of it with one with incremented power
|
||||||
template<typename T, int... Ints, typename... Rest>
|
template<typename T, int... Ints, typename... Rest>
|
||||||
struct expr_consolidate_impl<type_list<T, power<T, Ints...>, Rest...>> {
|
struct expr_consolidate_impl<type_list<T, power<T, Ints...>, Rest...>> {
|
||||||
using type =
|
using type = expr_consolidate_impl<type_list<power_or_T<T, power<T, Ints...>::exponent + 1>, Rest...>>::type;
|
||||||
expr_consolidate_impl<type_list<power_or_T<T, power<T, Ints...>::exponent + 1>, Rest...>>::type;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// accumulates the powers of instances of the same type (removes the element in case the accumulation result is `0`)
|
// accumulates the powers of instances of the same type (removes the element in case the accumulation result is `0`)
|
||||||
|
@@ -54,16 +54,16 @@ template<PointOrigin PO>
|
|||||||
struct point_origin_interface {
|
struct point_origin_interface {
|
||||||
template<PointOrigin PO, Quantity Q>
|
template<PointOrigin PO, Quantity Q>
|
||||||
requires ReferenceOf<std::remove_const_t<decltype(Q::reference)>, PO::quantity_spec>
|
requires ReferenceOf<std::remove_const_t<decltype(Q::reference)>, PO::quantity_spec>
|
||||||
[[nodiscard]] friend constexpr quantity_point<Q::reference, MP_UNITS_EXPRESSION_WORKAROUND(PO{}), typename Q::rep> operator+(
|
[[nodiscard]] friend constexpr quantity_point<Q::reference, MP_UNITS_EXPRESSION_WORKAROUND(PO{}), typename Q::rep>
|
||||||
PO, Q&& q)
|
operator+(PO, Q&& q)
|
||||||
{
|
{
|
||||||
return quantity_point{std::forward<Q>(q), PO{}};
|
return quantity_point{std::forward<Q>(q), PO{}};
|
||||||
}
|
}
|
||||||
|
|
||||||
template<Quantity Q, PointOrigin PO>
|
template<Quantity Q, PointOrigin PO>
|
||||||
requires ReferenceOf<std::remove_const_t<decltype(Q::reference)>, PO::quantity_spec>
|
requires ReferenceOf<std::remove_const_t<decltype(Q::reference)>, PO::quantity_spec>
|
||||||
[[nodiscard]] friend constexpr quantity_point<Q::reference, MP_UNITS_EXPRESSION_WORKAROUND(PO{}), typename Q::rep> operator+(
|
[[nodiscard]] friend constexpr quantity_point<Q::reference, MP_UNITS_EXPRESSION_WORKAROUND(PO{}), typename Q::rep>
|
||||||
Q&& q, PO po)
|
operator+(Q&& q, PO po)
|
||||||
{
|
{
|
||||||
return po + std::forward<Q>(q);
|
return po + std::forward<Q>(q);
|
||||||
}
|
}
|
||||||
|
@@ -1347,19 +1347,22 @@ template<QuantitySpec From, QuantitySpec To>
|
|||||||
};
|
};
|
||||||
if constexpr ((NamedQuantitySpec<decltype(MP_UNITS_IS_CONST_EXPR_WORKAROUND(from_kind))> &&
|
if constexpr ((NamedQuantitySpec<decltype(MP_UNITS_IS_CONST_EXPR_WORKAROUND(from_kind))> &&
|
||||||
NamedQuantitySpec<decltype(MP_UNITS_IS_CONST_EXPR_WORKAROUND(to_kind))>) ||
|
NamedQuantitySpec<decltype(MP_UNITS_IS_CONST_EXPR_WORKAROUND(to_kind))>) ||
|
||||||
get_complexity(MP_UNITS_IS_CONST_EXPR_WORKAROUND(from_kind)) == get_complexity(MP_UNITS_IS_CONST_EXPR_WORKAROUND(to_kind)))
|
get_complexity(MP_UNITS_IS_CONST_EXPR_WORKAROUND(from_kind)) ==
|
||||||
|
get_complexity(MP_UNITS_IS_CONST_EXPR_WORKAROUND(to_kind)))
|
||||||
return convertible_impl(MP_UNITS_IS_CONST_EXPR_WORKAROUND(from_kind), MP_UNITS_IS_CONST_EXPR_WORKAROUND(to_kind));
|
return convertible_impl(MP_UNITS_IS_CONST_EXPR_WORKAROUND(from_kind), MP_UNITS_IS_CONST_EXPR_WORKAROUND(to_kind));
|
||||||
else if constexpr (get_complexity(MP_UNITS_IS_CONST_EXPR_WORKAROUND(from_kind)) >
|
else if constexpr (get_complexity(MP_UNITS_IS_CONST_EXPR_WORKAROUND(from_kind)) >
|
||||||
get_complexity(MP_UNITS_IS_CONST_EXPR_WORKAROUND(to_kind)))
|
get_complexity(MP_UNITS_IS_CONST_EXPR_WORKAROUND(to_kind)))
|
||||||
return exploded_kind_result(convertible_impl(
|
return exploded_kind_result(
|
||||||
get_kind_tree_root(
|
convertible_impl(get_kind_tree_root(explode<get_complexity(MP_UNITS_IS_CONST_EXPR_WORKAROUND(to_kind))>(
|
||||||
explode<get_complexity(MP_UNITS_IS_CONST_EXPR_WORKAROUND(to_kind))>(MP_UNITS_IS_CONST_EXPR_WORKAROUND(from_kind)).quantity),
|
MP_UNITS_IS_CONST_EXPR_WORKAROUND(from_kind))
|
||||||
|
.quantity),
|
||||||
MP_UNITS_IS_CONST_EXPR_WORKAROUND(to_kind)));
|
MP_UNITS_IS_CONST_EXPR_WORKAROUND(to_kind)));
|
||||||
else
|
else
|
||||||
return exploded_kind_result(convertible_impl(
|
return exploded_kind_result(
|
||||||
MP_UNITS_IS_CONST_EXPR_WORKAROUND(from_kind),
|
convertible_impl(MP_UNITS_IS_CONST_EXPR_WORKAROUND(from_kind),
|
||||||
get_kind_tree_root(
|
get_kind_tree_root(explode<get_complexity(MP_UNITS_IS_CONST_EXPR_WORKAROUND(from_kind))>(
|
||||||
explode<get_complexity(MP_UNITS_IS_CONST_EXPR_WORKAROUND(from_kind))>(MP_UNITS_IS_CONST_EXPR_WORKAROUND(to_kind)).quantity)));
|
MP_UNITS_IS_CONST_EXPR_WORKAROUND(to_kind))
|
||||||
|
.quantity)));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<NamedQuantitySpec From, NamedQuantitySpec To>
|
template<NamedQuantitySpec From, NamedQuantitySpec To>
|
||||||
@@ -1377,10 +1380,12 @@ template<NamedQuantitySpec From, NamedQuantitySpec To>
|
|||||||
else if constexpr (get_complexity(From{}) != get_complexity(To{})) {
|
else if constexpr (get_complexity(From{}) != get_complexity(To{})) {
|
||||||
if constexpr (get_complexity(From{}) > get_complexity(To{}))
|
if constexpr (get_complexity(From{}) > get_complexity(To{}))
|
||||||
return convertible_impl(
|
return convertible_impl(
|
||||||
explode<get_complexity(MP_UNITS_IS_CONST_EXPR_WORKAROUND(to))>(MP_UNITS_IS_CONST_EXPR_WORKAROUND(from)).quantity,
|
explode<get_complexity(MP_UNITS_IS_CONST_EXPR_WORKAROUND(to))>(MP_UNITS_IS_CONST_EXPR_WORKAROUND(from))
|
||||||
|
.quantity,
|
||||||
MP_UNITS_IS_CONST_EXPR_WORKAROUND(to));
|
MP_UNITS_IS_CONST_EXPR_WORKAROUND(to));
|
||||||
else {
|
else {
|
||||||
auto res = explode<get_complexity(MP_UNITS_IS_CONST_EXPR_WORKAROUND(from))>(MP_UNITS_IS_CONST_EXPR_WORKAROUND(to));
|
auto res =
|
||||||
|
explode<get_complexity(MP_UNITS_IS_CONST_EXPR_WORKAROUND(from))>(MP_UNITS_IS_CONST_EXPR_WORKAROUND(to));
|
||||||
return min(res.result, convertible_impl(MP_UNITS_IS_CONST_EXPR_WORKAROUND(from), res.quantity));
|
return min(res.result, convertible_impl(MP_UNITS_IS_CONST_EXPR_WORKAROUND(from), res.quantity));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1413,7 +1418,8 @@ template<QuantitySpec From, QuantitySpec To>
|
|||||||
auto eq = explode_to_equation(MP_UNITS_IS_CONST_EXPR_WORKAROUND(to));
|
auto eq = explode_to_equation(MP_UNITS_IS_CONST_EXPR_WORKAROUND(to));
|
||||||
return min(eq.result, convertible_impl(res.quantity, eq.equation));
|
return min(eq.result, convertible_impl(res.quantity, eq.equation));
|
||||||
} else
|
} else
|
||||||
return are_ingredients_convertible(MP_UNITS_IS_CONST_EXPR_WORKAROUND(from), MP_UNITS_IS_CONST_EXPR_WORKAROUND(to));
|
return are_ingredients_convertible(MP_UNITS_IS_CONST_EXPR_WORKAROUND(from),
|
||||||
|
MP_UNITS_IS_CONST_EXPR_WORKAROUND(to));
|
||||||
} else if constexpr (DerivedQuantitySpec<To>) {
|
} else if constexpr (DerivedQuantitySpec<To>) {
|
||||||
auto res = explode<get_complexity(MP_UNITS_IS_CONST_EXPR_WORKAROUND(from))>(MP_UNITS_IS_CONST_EXPR_WORKAROUND(to));
|
auto res = explode<get_complexity(MP_UNITS_IS_CONST_EXPR_WORKAROUND(from))>(MP_UNITS_IS_CONST_EXPR_WORKAROUND(to));
|
||||||
if constexpr (NamedQuantitySpec<decltype(res.quantity)>)
|
if constexpr (NamedQuantitySpec<decltype(res.quantity)>)
|
||||||
@@ -1421,7 +1427,8 @@ template<QuantitySpec From, QuantitySpec To>
|
|||||||
else if constexpr (requires { MP_UNITS_IS_CONST_EXPR_WORKAROUND(from)._equation_; })
|
else if constexpr (requires { MP_UNITS_IS_CONST_EXPR_WORKAROUND(from)._equation_; })
|
||||||
return min(res.result, convertible_impl(MP_UNITS_IS_CONST_EXPR_WORKAROUND(from)._equation_, res.quantity));
|
return min(res.result, convertible_impl(MP_UNITS_IS_CONST_EXPR_WORKAROUND(from)._equation_, res.quantity));
|
||||||
else
|
else
|
||||||
return min(res.result, are_ingredients_convertible(MP_UNITS_IS_CONST_EXPR_WORKAROUND(from), MP_UNITS_IS_CONST_EXPR_WORKAROUND(to)));
|
return min(res.result, are_ingredients_convertible(MP_UNITS_IS_CONST_EXPR_WORKAROUND(from),
|
||||||
|
MP_UNITS_IS_CONST_EXPR_WORKAROUND(to)));
|
||||||
}
|
}
|
||||||
// NOLINTEND(bugprone-branch-clone)
|
// NOLINTEND(bugprone-branch-clone)
|
||||||
return no;
|
return no;
|
||||||
|
@@ -87,14 +87,15 @@ struct reference {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename Q2, typename U2>
|
template<typename Q2, typename U2>
|
||||||
[[nodiscard]] friend consteval detail::reference_t< MP_UNITS_EXPRESSION_WORKAROUND(Q{} * Q2{}), MP_UNITS_EXPRESSION_WORKAROUND(U{} * U2{})>
|
[[nodiscard]] friend consteval detail::reference_t<MP_UNITS_EXPRESSION_WORKAROUND(Q{} * Q2{}),
|
||||||
|
MP_UNITS_EXPRESSION_WORKAROUND(U{} * U2{})>
|
||||||
operator*(reference, reference<Q2, U2>)
|
operator*(reference, reference<Q2, U2>)
|
||||||
{
|
{
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
template<AssociatedUnit U2>
|
template<AssociatedUnit U2>
|
||||||
[[nodiscard]] friend consteval detail::reference_t<( MP_UNITS_EXPRESSION_WORKAROUND(Q{} * get_quantity_spec(U2{}))),
|
[[nodiscard]] friend consteval detail::reference_t<(MP_UNITS_EXPRESSION_WORKAROUND(Q{} * get_quantity_spec(U2{}))),
|
||||||
MP_UNITS_EXPRESSION_WORKAROUND(U{} * U2{})>
|
MP_UNITS_EXPRESSION_WORKAROUND(U{} * U2{})>
|
||||||
operator*(reference, U2)
|
operator*(reference, U2)
|
||||||
{
|
{
|
||||||
@@ -102,7 +103,7 @@ struct reference {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<AssociatedUnit U1>
|
template<AssociatedUnit U1>
|
||||||
[[nodiscard]] friend consteval detail::reference_t< MP_UNITS_EXPRESSION_WORKAROUND(get_quantity_spec(U1{}) * Q{}),
|
[[nodiscard]] friend consteval detail::reference_t<MP_UNITS_EXPRESSION_WORKAROUND(get_quantity_spec(U1{}) * Q{}),
|
||||||
MP_UNITS_EXPRESSION_WORKAROUND(U1{} * U{})>
|
MP_UNITS_EXPRESSION_WORKAROUND(U1{} * U{})>
|
||||||
operator*(U1, reference)
|
operator*(U1, reference)
|
||||||
{
|
{
|
||||||
@@ -110,14 +111,15 @@ struct reference {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename Q2, typename U2>
|
template<typename Q2, typename U2>
|
||||||
[[nodiscard]] friend consteval detail::reference_t< MP_UNITS_EXPRESSION_WORKAROUND(Q{} / Q2{}), MP_UNITS_EXPRESSION_WORKAROUND(U{} / U2{})>
|
[[nodiscard]] friend consteval detail::reference_t<MP_UNITS_EXPRESSION_WORKAROUND(Q{} / Q2{}),
|
||||||
|
MP_UNITS_EXPRESSION_WORKAROUND(U{} / U2{})>
|
||||||
operator/(reference, reference<Q2, U2>)
|
operator/(reference, reference<Q2, U2>)
|
||||||
{
|
{
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
template<AssociatedUnit U2>
|
template<AssociatedUnit U2>
|
||||||
[[nodiscard]] friend consteval detail::reference_t< MP_UNITS_EXPRESSION_WORKAROUND(Q{} / get_quantity_spec(U2{})),
|
[[nodiscard]] friend consteval detail::reference_t<MP_UNITS_EXPRESSION_WORKAROUND(Q{} / get_quantity_spec(U2{})),
|
||||||
MP_UNITS_EXPRESSION_WORKAROUND(U{} / U2{})>
|
MP_UNITS_EXPRESSION_WORKAROUND(U{} / U2{})>
|
||||||
operator/(reference, U2)
|
operator/(reference, U2)
|
||||||
{
|
{
|
||||||
@@ -125,7 +127,7 @@ struct reference {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<AssociatedUnit U1>
|
template<AssociatedUnit U1>
|
||||||
[[nodiscard]] friend consteval detail::reference_t< MP_UNITS_EXPRESSION_WORKAROUND(get_quantity_spec(U1{}) / Q{}),
|
[[nodiscard]] friend consteval detail::reference_t<MP_UNITS_EXPRESSION_WORKAROUND(get_quantity_spec(U1{}) / Q{}),
|
||||||
MP_UNITS_EXPRESSION_WORKAROUND(U1{} / U{})>
|
MP_UNITS_EXPRESSION_WORKAROUND(U1{} / U{})>
|
||||||
operator/(U1, reference)
|
operator/(U1, reference)
|
||||||
{
|
{
|
||||||
@@ -295,10 +297,11 @@ template<Reference R1, Reference R2, Reference... Rest>
|
|||||||
} -> Unit;
|
} -> Unit;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
return detail::reference_t<
|
return detail::reference_t<common_quantity_spec(get_quantity_spec(MP_UNITS_IS_CONST_EXPR_WORKAROUND(r1)),
|
||||||
common_quantity_spec(get_quantity_spec(MP_UNITS_IS_CONST_EXPR_WORKAROUND(r1)), get_quantity_spec(MP_UNITS_IS_CONST_EXPR_WORKAROUND(r2)),
|
get_quantity_spec(MP_UNITS_IS_CONST_EXPR_WORKAROUND(r2)),
|
||||||
get_quantity_spec(rest)...),
|
get_quantity_spec(rest)...),
|
||||||
common_unit(get_unit(MP_UNITS_IS_CONST_EXPR_WORKAROUND(r1)), get_unit(MP_UNITS_IS_CONST_EXPR_WORKAROUND(r2)), get_unit(rest)...)>{};
|
common_unit(get_unit(MP_UNITS_IS_CONST_EXPR_WORKAROUND(r1)),
|
||||||
|
get_unit(MP_UNITS_IS_CONST_EXPR_WORKAROUND(r2)), get_unit(rest)...)>{};
|
||||||
}
|
}
|
||||||
|
|
||||||
MP_UNITS_EXPORT_END
|
MP_UNITS_EXPORT_END
|
||||||
|
@@ -87,7 +87,8 @@ template<ReferenceOf<MP_UNITS_IS_VALUE_WORKAROUND(isq::angular_measure)> auto R,
|
|||||||
|
|
||||||
template<ReferenceOf<dimensionless> auto R, typename Rep>
|
template<ReferenceOf<dimensionless> auto R, typename Rep>
|
||||||
requires requires(Rep v) { asin(v); } || requires(Rep v) { std::asin(v); }
|
requires requires(Rep v) { asin(v); } || requires(Rep v) { std::asin(v); }
|
||||||
[[nodiscard]] inline QuantityOf<MP_UNITS_IS_VALUE_WORKAROUND(isq::angular_measure)> auto asin(const quantity<R, Rep>& q) noexcept
|
[[nodiscard]] inline QuantityOf<MP_UNITS_IS_VALUE_WORKAROUND(isq::angular_measure)> auto asin(
|
||||||
|
const quantity<R, Rep>& q) noexcept
|
||||||
{
|
{
|
||||||
using std::asin;
|
using std::asin;
|
||||||
if constexpr (!treat_as_floating_point<Rep>) {
|
if constexpr (!treat_as_floating_point<Rep>) {
|
||||||
@@ -101,7 +102,8 @@ template<ReferenceOf<dimensionless> auto R, typename Rep>
|
|||||||
|
|
||||||
template<ReferenceOf<dimensionless> auto R, typename Rep>
|
template<ReferenceOf<dimensionless> auto R, typename Rep>
|
||||||
requires requires(Rep v) { acos(v); } || requires(Rep v) { std::acos(v); }
|
requires requires(Rep v) { acos(v); } || requires(Rep v) { std::acos(v); }
|
||||||
[[nodiscard]] inline QuantityOf<MP_UNITS_IS_VALUE_WORKAROUND(isq::angular_measure)> auto acos(const quantity<R, Rep>& q) noexcept
|
[[nodiscard]] inline QuantityOf<MP_UNITS_IS_VALUE_WORKAROUND(isq::angular_measure)> auto acos(
|
||||||
|
const quantity<R, Rep>& q) noexcept
|
||||||
{
|
{
|
||||||
using std::acos;
|
using std::acos;
|
||||||
if constexpr (!treat_as_floating_point<Rep>) {
|
if constexpr (!treat_as_floating_point<Rep>) {
|
||||||
@@ -115,7 +117,8 @@ template<ReferenceOf<dimensionless> auto R, typename Rep>
|
|||||||
|
|
||||||
template<ReferenceOf<dimensionless> auto R, typename Rep>
|
template<ReferenceOf<dimensionless> auto R, typename Rep>
|
||||||
requires requires(Rep v) { atan(v); } || requires(Rep v) { std::atan(v); }
|
requires requires(Rep v) { atan(v); } || requires(Rep v) { std::atan(v); }
|
||||||
[[nodiscard]] inline QuantityOf<MP_UNITS_IS_VALUE_WORKAROUND(isq::angular_measure)> auto atan(const quantity<R, Rep>& q) noexcept
|
[[nodiscard]] inline QuantityOf<MP_UNITS_IS_VALUE_WORKAROUND(isq::angular_measure)> auto atan(
|
||||||
|
const quantity<R, Rep>& q) noexcept
|
||||||
{
|
{
|
||||||
using std::atan;
|
using std::atan;
|
||||||
if constexpr (!treat_as_floating_point<Rep>) {
|
if constexpr (!treat_as_floating_point<Rep>) {
|
||||||
|
Reference in New Issue
Block a user