diff --git a/au/magnitude.hh b/au/magnitude.hh index c0a585dc..26fafb50 100644 --- a/au/magnitude.hh +++ b/au/magnitude.hh @@ -131,7 +131,16 @@ using CommonMagnitudeT = typename CommonMagnitude::type; // Value based interface for Magnitude. static constexpr auto ONE = Magnitude<>{}; + +#ifndef PI +// Some users must work with frameworks that define `PI` as a macro. Having a macro with this +// easily collidable name is exceedingly unwise. Nevertheless, that's not the users' fault, so we +// accommodate those frameworks by omitting the definition of `PI` in this case. +// +// If you are stuck with such a framework, you can choose a different name that does not collide, +// and reproduce the following line in your own system. static constexpr auto PI = Magnitude{}; +#endif template constexpr auto operator*(Magnitude, Magnitude) { diff --git a/au/stdx/type_traits.hh b/au/stdx/type_traits.hh index ae28e4a1..db4402b7 100644 --- a/au/stdx/type_traits.hh +++ b/au/stdx/type_traits.hh @@ -32,18 +32,18 @@ using bool_constant = std::integral_constant; // Source: adapted from (https://en.cppreference.com/w/cpp/types/conjunction). template struct conjunction : std::true_type {}; -template -struct conjunction : B1 {}; -template -struct conjunction : std::conditional_t, B1> {}; +template +struct conjunction : B {}; +template +struct conjunction : std::conditional_t, B> {}; // Source: adapted from (https://en.cppreference.com/w/cpp/types/disjunction). template struct disjunction : std::false_type {}; -template -struct disjunction : B1 {}; -template -struct disjunction : std::conditional_t> {}; +template +struct disjunction : B {}; +template +struct disjunction : std::conditional_t> {}; // Source: adapted from (https://en.cppreference.com/w/cpp/types/negation). template diff --git a/au/units/degrees.hh b/au/units/degrees.hh index b32632e9..333e8c06 100644 --- a/au/units/degrees.hh +++ b/au/units/degrees.hh @@ -28,7 +28,7 @@ struct DegreesLabel { }; template constexpr const char DegreesLabel::label[]; -struct Degrees : decltype(Radians{} * PI / mag<180>()), DegreesLabel { +struct Degrees : decltype(Radians{} * Magnitude{} / mag<180>()), DegreesLabel { using DegreesLabel::label; }; constexpr auto degree = SingularNameFor{};