mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-02 20:04:27 +02:00
refactor: pi
mag_constant
refactored to be one-liner
This commit is contained in:
@@ -184,10 +184,9 @@ For some units, a magnitude might also be irrational. The best example here is a
|
||||
is defined using a floating-point magnitude having a factor of the number π (Pi):
|
||||
|
||||
```cpp
|
||||
struct pi : mag_constant {
|
||||
inline constexpr struct pi : mag_constant {
|
||||
static constexpr auto value = std::numbers::pi_v<long double>;
|
||||
};
|
||||
inline constexpr pi pi;
|
||||
} pi;
|
||||
```
|
||||
|
||||
```cpp
|
||||
|
@@ -584,10 +584,9 @@ constexpr Magnitude auto mag_power = pow<Pow>(mag<Base>);
|
||||
/**
|
||||
* @brief A convenient Magnitude constant for pi, which we can manipulate like a regular number.
|
||||
*/
|
||||
struct pi : mag_constant {
|
||||
inline constexpr struct pi : mag_constant {
|
||||
static constexpr auto value = std::numbers::pi_v<long double>;
|
||||
};
|
||||
inline constexpr pi pi;
|
||||
} pi;
|
||||
|
||||
[[deprecated("Use `mag<pi>` instead")]] inline constexpr Magnitude auto mag_pi = mag<pi>;
|
||||
|
||||
|
Reference in New Issue
Block a user