mirror of
https://github.com/mpusz/mp-units.git
synced 2025-07-31 10:57:16 +02:00
Electronvolt and dalton support added
This commit is contained in:
@ -35,6 +35,8 @@ struct kilojoule : prefixed_unit<kilojoule, kilo, joule> {};
|
||||
struct megajoule : prefixed_unit<megajoule, mega, joule> {};
|
||||
struct gigajoule : prefixed_unit<gigajoule, giga, joule> {};
|
||||
|
||||
struct electronvolt : named_scaled_unit<electronvolt, "eV", no_prefix, ratio<1'602'176'634, 1'000'000'000, -19>, joule> {};
|
||||
|
||||
struct dim_energy : physical::dim_energy<dim_energy, joule, dim_force, dim_length> {};
|
||||
|
||||
template<Unit U, Scalar Rep = double>
|
||||
@ -62,6 +64,10 @@ constexpr auto operator""MJ(long double l) { return energy<megajoule, long doubl
|
||||
constexpr auto operator""GJ(unsigned long long l) { return energy<gigajoule, std::int64_t>(l); }
|
||||
constexpr auto operator""GJ(long double l) { return energy<gigajoule, long double>(l); }
|
||||
|
||||
// eV
|
||||
constexpr auto operator""eV(unsigned long long l) { return energy<electronvolt, std::int64_t>(l); }
|
||||
constexpr auto operator""eV(long double l) { return energy<electronvolt, long double>(l); }
|
||||
|
||||
} // namespace literals
|
||||
|
||||
} // namespace units::si
|
||||
|
@ -32,6 +32,8 @@ struct gram : named_unit<gram, "g", prefix> {};
|
||||
struct kilogram : prefixed_unit<kilogram, kilo, gram> {};
|
||||
struct tonne : named_scaled_unit<tonne, "t", prefix, ratio<1'000>, kilogram> {};
|
||||
|
||||
struct dalton : named_scaled_unit<dalton, "Da", no_prefix, ratio<16'605'390'666'050, 10'000'000'000'000, -27>, kilogram> {};
|
||||
|
||||
struct dim_mass : physical::dim_mass<kilogram> {};
|
||||
|
||||
template<Unit U, Scalar Rep = double>
|
||||
@ -51,6 +53,10 @@ constexpr auto operator""kg(long double l) { return mass<kilogram, long double>(
|
||||
constexpr auto operator""t(unsigned long long l) { return mass<tonne, std::int64_t>(l); }
|
||||
constexpr auto operator""t(long double l) { return mass<tonne, long double>(l); }
|
||||
|
||||
// Da
|
||||
constexpr auto operator""Da(unsigned long long l) { return mass<dalton, std::int64_t>(l); }
|
||||
constexpr auto operator""Da(long double l) { return mass<dalton, long double>(l); }
|
||||
|
||||
} // namespace literals
|
||||
|
||||
} // namespace units::si
|
||||
|
Reference in New Issue
Block a user