Skip to content

Commit

Permalink
Deployed 30440ed to main with MkDocs 1.5.3 and mike 1.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed May 2, 2024
1 parent 704ce15 commit a3e8086
Show file tree
Hide file tree
Showing 6 changed files with 166 additions and 54 deletions.
32 changes: 30 additions & 2 deletions main/au.hh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include <type_traits>
#include <utility>

// Version identifier: 0.3.4-6-g87bf5b3
// Version identifier: 0.3.4-7-g30440ed
// <iostream> support: INCLUDED
// List of included units:
// amperes
Expand Down Expand Up @@ -4525,6 +4525,9 @@ struct AreQuantityPointTypesEquivalent;
namespace detail {
template <typename TargetRep, typename U1, typename U2>
struct OriginDisplacementFitsIn;

template <typename FromRep, typename ToRep>
struct IntermediateRep;
} // namespace detail

// QuantityPoint implementation and API elaboration.
Expand Down Expand Up @@ -4605,7 +4608,9 @@ class QuantityPoint {
typename NewUnit,
typename = std::enable_if_t<IsUnit<NewUnit>::value>>
constexpr NewRep in(NewUnit u) const {
return (rep_cast<NewRep>(x_) - rep_cast<NewRep>(OriginDisplacement<Unit, NewUnit>::value()))
using CalcRep = typename detail::IntermediateRep<Rep, NewRep>::type;
return (rep_cast<CalcRep>(x_) -
rep_cast<CalcRep>(OriginDisplacement<Unit, NewUnit>::value()))
.template in<NewRep>(u);
}

Expand Down Expand Up @@ -4908,6 +4913,29 @@ struct OriginDisplacementFitsIn
stdx::bool_constant<underlying_value_in_range<TargetRep>(
OriginDisplacement<U1, U2>::value())>,
std::true_type> {};

// We simply want a version of `std::make_signed_t` that won't choke on non-integral types.
template <typename T, bool IsInt = std::is_integral<T>::value>
struct MakeSigned;
template <typename T>
struct MakeSigned<T, false> : stdx::type_identity<T> {};
template <typename T>
struct MakeSigned<T, true> : stdx::type_identity<std::make_signed_t<T>> {};

// If the destination is a signed integer, we want to ensure we do our
// computations in a signed type. Otherwise, just use the common type for our
// intermediate computations.
template <typename CommonT, bool IsDestinationSigned>
struct IntermediateRepImpl
: std::conditional_t<stdx::conjunction<std::is_integral<CommonT>,
stdx::bool_constant<IsDestinationSigned>>::value,
MakeSigned<CommonT>,
stdx::type_identity<CommonT>> {};

template <typename FromRep, typename ToRep>
struct IntermediateRep
: IntermediateRepImpl<std::common_type_t<FromRep, ToRep>, std::is_signed<ToRep>::value> {};

} // namespace detail
} // namespace au

Expand Down
32 changes: 30 additions & 2 deletions main/au_all_units.hh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include <type_traits>
#include <utility>

// Version identifier: 0.3.4-6-g87bf5b3
// Version identifier: 0.3.4-7-g30440ed
// <iostream> support: INCLUDED
// List of included units:
// amperes
Expand Down Expand Up @@ -4567,6 +4567,9 @@ struct AreQuantityPointTypesEquivalent;
namespace detail {
template <typename TargetRep, typename U1, typename U2>
struct OriginDisplacementFitsIn;

template <typename FromRep, typename ToRep>
struct IntermediateRep;
} // namespace detail

// QuantityPoint implementation and API elaboration.
Expand Down Expand Up @@ -4647,7 +4650,9 @@ class QuantityPoint {
typename NewUnit,
typename = std::enable_if_t<IsUnit<NewUnit>::value>>
constexpr NewRep in(NewUnit u) const {
return (rep_cast<NewRep>(x_) - rep_cast<NewRep>(OriginDisplacement<Unit, NewUnit>::value()))
using CalcRep = typename detail::IntermediateRep<Rep, NewRep>::type;
return (rep_cast<CalcRep>(x_) -
rep_cast<CalcRep>(OriginDisplacement<Unit, NewUnit>::value()))
.template in<NewRep>(u);
}

Expand Down Expand Up @@ -4950,6 +4955,29 @@ struct OriginDisplacementFitsIn
stdx::bool_constant<underlying_value_in_range<TargetRep>(
OriginDisplacement<U1, U2>::value())>,
std::true_type> {};

// We simply want a version of `std::make_signed_t` that won't choke on non-integral types.
template <typename T, bool IsInt = std::is_integral<T>::value>
struct MakeSigned;
template <typename T>
struct MakeSigned<T, false> : stdx::type_identity<T> {};
template <typename T>
struct MakeSigned<T, true> : stdx::type_identity<std::make_signed_t<T>> {};

// If the destination is a signed integer, we want to ensure we do our
// computations in a signed type. Otherwise, just use the common type for our
// intermediate computations.
template <typename CommonT, bool IsDestinationSigned>
struct IntermediateRepImpl
: std::conditional_t<stdx::conjunction<std::is_integral<CommonT>,
stdx::bool_constant<IsDestinationSigned>>::value,
MakeSigned<CommonT>,
stdx::type_identity<CommonT>> {};

template <typename FromRep, typename ToRep>
struct IntermediateRep
: IntermediateRepImpl<std::common_type_t<FromRep, ToRep>, std::is_signed<ToRep>::value> {};

} // namespace detail
} // namespace au

Expand Down
32 changes: 30 additions & 2 deletions main/au_all_units_noio.hh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <type_traits>
#include <utility>

// Version identifier: 0.3.4-6-g87bf5b3
// Version identifier: 0.3.4-7-g30440ed
// <iostream> support: EXCLUDED
// List of included units:
// amperes
Expand Down Expand Up @@ -4344,6 +4344,9 @@ struct AreQuantityPointTypesEquivalent;
namespace detail {
template <typename TargetRep, typename U1, typename U2>
struct OriginDisplacementFitsIn;

template <typename FromRep, typename ToRep>
struct IntermediateRep;
} // namespace detail

// QuantityPoint implementation and API elaboration.
Expand Down Expand Up @@ -4424,7 +4427,9 @@ class QuantityPoint {
typename NewUnit,
typename = std::enable_if_t<IsUnit<NewUnit>::value>>
constexpr NewRep in(NewUnit u) const {
return (rep_cast<NewRep>(x_) - rep_cast<NewRep>(OriginDisplacement<Unit, NewUnit>::value()))
using CalcRep = typename detail::IntermediateRep<Rep, NewRep>::type;
return (rep_cast<CalcRep>(x_) -
rep_cast<CalcRep>(OriginDisplacement<Unit, NewUnit>::value()))
.template in<NewRep>(u);
}

Expand Down Expand Up @@ -4727,6 +4732,29 @@ struct OriginDisplacementFitsIn
stdx::bool_constant<underlying_value_in_range<TargetRep>(
OriginDisplacement<U1, U2>::value())>,
std::true_type> {};

// We simply want a version of `std::make_signed_t` that won't choke on non-integral types.
template <typename T, bool IsInt = std::is_integral<T>::value>
struct MakeSigned;
template <typename T>
struct MakeSigned<T, false> : stdx::type_identity<T> {};
template <typename T>
struct MakeSigned<T, true> : stdx::type_identity<std::make_signed_t<T>> {};

// If the destination is a signed integer, we want to ensure we do our
// computations in a signed type. Otherwise, just use the common type for our
// intermediate computations.
template <typename CommonT, bool IsDestinationSigned>
struct IntermediateRepImpl
: std::conditional_t<stdx::conjunction<std::is_integral<CommonT>,
stdx::bool_constant<IsDestinationSigned>>::value,
MakeSigned<CommonT>,
stdx::type_identity<CommonT>> {};

template <typename FromRep, typename ToRep>
struct IntermediateRep
: IntermediateRepImpl<std::common_type_t<FromRep, ToRep>, std::is_signed<ToRep>::value> {};

} // namespace detail
} // namespace au

Expand Down
32 changes: 30 additions & 2 deletions main/au_noio.hh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <type_traits>
#include <utility>

// Version identifier: 0.3.4-6-g87bf5b3
// Version identifier: 0.3.4-7-g30440ed
// <iostream> support: EXCLUDED
// List of included units:
// amperes
Expand Down Expand Up @@ -4506,6 +4506,9 @@ struct AreQuantityPointTypesEquivalent;
namespace detail {
template <typename TargetRep, typename U1, typename U2>
struct OriginDisplacementFitsIn;

template <typename FromRep, typename ToRep>
struct IntermediateRep;
} // namespace detail

// QuantityPoint implementation and API elaboration.
Expand Down Expand Up @@ -4586,7 +4589,9 @@ class QuantityPoint {
typename NewUnit,
typename = std::enable_if_t<IsUnit<NewUnit>::value>>
constexpr NewRep in(NewUnit u) const {
return (rep_cast<NewRep>(x_) - rep_cast<NewRep>(OriginDisplacement<Unit, NewUnit>::value()))
using CalcRep = typename detail::IntermediateRep<Rep, NewRep>::type;
return (rep_cast<CalcRep>(x_) -
rep_cast<CalcRep>(OriginDisplacement<Unit, NewUnit>::value()))
.template in<NewRep>(u);
}

Expand Down Expand Up @@ -4889,6 +4894,29 @@ struct OriginDisplacementFitsIn
stdx::bool_constant<underlying_value_in_range<TargetRep>(
OriginDisplacement<U1, U2>::value())>,
std::true_type> {};

// We simply want a version of `std::make_signed_t` that won't choke on non-integral types.
template <typename T, bool IsInt = std::is_integral<T>::value>
struct MakeSigned;
template <typename T>
struct MakeSigned<T, false> : stdx::type_identity<T> {};
template <typename T>
struct MakeSigned<T, true> : stdx::type_identity<std::make_signed_t<T>> {};

// If the destination is a signed integer, we want to ensure we do our
// computations in a signed type. Otherwise, just use the common type for our
// intermediate computations.
template <typename CommonT, bool IsDestinationSigned>
struct IntermediateRepImpl
: std::conditional_t<stdx::conjunction<std::is_integral<CommonT>,
stdx::bool_constant<IsDestinationSigned>>::value,
MakeSigned<CommonT>,
stdx::type_identity<CommonT>> {};

template <typename FromRep, typename ToRep>
struct IntermediateRep
: IntermediateRepImpl<std::common_type_t<FromRep, ToRep>, std::is_signed<ToRep>::value> {};

} // namespace detail
} // namespace au

Expand Down
Loading

0 comments on commit a3e8086

Please sign in to comment.