mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-04 20:54:28 +02:00
astronomical unit added
This commit is contained in:
@@ -34,6 +34,8 @@ struct centimetre : prefixed_unit<centimetre, centi, metre> {};
|
|||||||
struct decimetre : prefixed_unit<decimetre, deci, metre> {};
|
struct decimetre : prefixed_unit<decimetre, deci, metre> {};
|
||||||
struct kilometre : prefixed_unit<kilometre, kilo, metre> {};
|
struct kilometre : prefixed_unit<kilometre, kilo, metre> {};
|
||||||
|
|
||||||
|
struct astronomical_unit : named_scaled_unit<astronomical_unit, "au", no_prefix, ratio<149'597'870'700>, metre> {};
|
||||||
|
|
||||||
struct dim_length : physical::dim_length<metre> {};
|
struct dim_length : physical::dim_length<metre> {};
|
||||||
|
|
||||||
template<Unit U, Scalar Rep = double>
|
template<Unit U, Scalar Rep = double>
|
||||||
@@ -61,6 +63,10 @@ constexpr auto operator"" dm(long double l) { return length<decimetre, long doub
|
|||||||
constexpr auto operator"" km(unsigned long long l) { return length<kilometre, std::int64_t>(l); }
|
constexpr auto operator"" km(unsigned long long l) { return length<kilometre, std::int64_t>(l); }
|
||||||
constexpr auto operator"" km(long double l) { return length<kilometre, long double>(l); }
|
constexpr auto operator"" km(long double l) { return length<kilometre, long double>(l); }
|
||||||
|
|
||||||
|
// au
|
||||||
|
constexpr auto operator"" au(unsigned long long l) { return length<astronomical_unit, std::int64_t>(l); }
|
||||||
|
constexpr auto operator"" au(long double l) { return length<astronomical_unit, long double>(l); }
|
||||||
|
|
||||||
} // namespace literals
|
} // namespace literals
|
||||||
|
|
||||||
} // namespace units::si
|
} // namespace units::si
|
||||||
|
@@ -55,6 +55,7 @@ static_assert(1km == 1000m);
|
|||||||
static_assert(1m == 100cm);
|
static_assert(1m == 100cm);
|
||||||
static_assert(1m == 10dm);
|
static_assert(1m == 10dm);
|
||||||
static_assert(1m == 1000mm);
|
static_assert(1m == 1000mm);
|
||||||
|
static_assert(1au == 149'597'870'700m);
|
||||||
static_assert(1km + 1m == 1001m);
|
static_assert(1km + 1m == 1001m);
|
||||||
static_assert(10km / 5km == 2);
|
static_assert(10km / 5km == 2);
|
||||||
static_assert(100mm / 5cm == 2);
|
static_assert(100mm / 5cm == 2);
|
||||||
|
Reference in New Issue
Block a user