From 4330cabd59c9aa41fb230aa091e0e0c952cc3652 Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Tue, 13 Jun 2023 09:14:53 +0300 Subject: [PATCH] feat: `pow`, `sqrt`, and `cbrt` support added for `reference` --- src/core/include/mp-units/reference.h | 34 +++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/core/include/mp-units/reference.h b/src/core/include/mp-units/reference.h index 120d27be..7bec290c 100644 --- a/src/core/include/mp-units/reference.h +++ b/src/core/include/mp-units/reference.h @@ -106,6 +106,40 @@ struct reference { return {}; } + /** + * @brief Computes the value of a reference raised to the `Num/Den` power + * + * @tparam Num Exponent numerator + * @tparam Den Exponent denominator + * @param r Reference being the base of the operation + * + * @return The result of computation + */ + template + requires detail::non_zero + [[nodiscard]] friend consteval reference(Q), pow(U)> pow(reference) + { + return {}; + } + + /** + * @brief Computes the square root of a reference + * + * @param r Reference being the base of the operation + * + * @return The result of computation + */ + [[nodiscard]] friend consteval reference sqrt(reference) { return {}; } + + /** + * @brief Computes the cubic root of a reference + * + * @param r Reference being the base of the operation + * + * @return The result of computation + */ + [[nodiscard]] friend consteval reference cbrt(reference) { return {}; } + template [[nodiscard]] friend consteval bool convertible(reference, reference) {