Make pow()'s argument a simple (non-template) parameter

This commit is contained in:
Chip Hogg committed 2022-01-11 19:19:25 -05:00
1 parent a8d6c890a5
commit 08818ac6a8
2 files changed
+6 -7

No files matched your search

+3 -4
View File
@@ -128,9 +128,8 @@ constexpr bool operator==(T t, U u) {
/**
* @brief A BasePower, raised to a rational power E.
*/
template<ratio E>
constexpr auto pow(BasePower auto bp) {
bp.power = bp.power * E;
constexpr auto pow(BasePower auto bp, ratio p) {
bp.power = bp.power * p;
return bp;
}
@@ -274,7 +273,7 @@ constexpr bool operator==(magnitude<LeftBPs...>, magnitude<RightBPs...>) {
template<ratio E, BasePower auto... BPs>
constexpr auto pow(magnitude<BPs...>) {
if constexpr (E == 0) { return magnitude<>{}; }
else { return magnitude<pow<E>(BPs)...>{}; }
else { return magnitude<pow(BPs, E)...>{}; }
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////