forked from mpusz/mp-units
Simplify namespaces and canonicalize formatting
The motivation for the `mag` sub-namespace was to distinguish something like `mag::product_t<...>` from `dim::product_t<...>`, based on the idioms of Aurora Units. However, we have no need for a `product_t` type trait, since we can just use `operator*()`, so we can eliminate this sub-namespace.
This commit is contained in:
@@ -26,7 +26,7 @@
|
|||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <numbers>
|
#include <numbers>
|
||||||
|
|
||||||
namespace units::mag {
|
namespace units {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Any type which can be used as a basis vector in a BasePower.
|
* @brief Any type which can be used as a basis vector in a BasePower.
|
||||||
@@ -339,8 +339,7 @@ constexpr Magnitude auto as_magnitude() {
|
|||||||
/ detail::prime_factorization_v<R.den>;
|
/ detail::prime_factorization_v<R.den>;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace detail
|
namespace detail {
|
||||||
{
|
|
||||||
// Default implementation.
|
// Default implementation.
|
||||||
template<std::intmax_t N>
|
template<std::intmax_t N>
|
||||||
requires (N > 0)
|
requires (N > 0)
|
||||||
@@ -358,4 +357,4 @@ template<>
|
|||||||
struct prime_factorization<1> { static constexpr magnitude<> value{}; };
|
struct prime_factorization<1> { static constexpr magnitude<> value{}; };
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
|
||||||
} // namespace units::mag
|
} // namespace units
|
||||||
|
@@ -25,8 +25,7 @@
|
|||||||
#include <catch2/catch.hpp>
|
#include <catch2/catch.hpp>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
namespace units::mag
|
namespace units {
|
||||||
{
|
|
||||||
|
|
||||||
// A set of non-standard bases for testing purposes.
|
// A set of non-standard bases for testing purposes.
|
||||||
struct noninteger_base { static constexpr long double value = 1.234L; };
|
struct noninteger_base { static constexpr long double value = 1.234L; };
|
||||||
@@ -216,8 +215,7 @@ TEST_CASE("Can raise Magnitudes to rational powers")
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace detail
|
namespace detail {
|
||||||
{
|
|
||||||
|
|
||||||
TEST_CASE("Prime helper functions")
|
TEST_CASE("Prime helper functions")
|
||||||
{
|
{
|
||||||
@@ -375,4 +373,4 @@ TEST_CASE("strictly_increasing")
|
|||||||
|
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
|
||||||
} // namespace units::mag
|
} // namespace units
|
||||||
|
Reference in New Issue
Block a user