mirror of
https://github.com/mpusz/mp-units.git
synced 2025-07-30 02:17:16 +02:00
refactor: 💥 ! PrefixFamily
support removed
It doesn't have much sense to restrict prefixes usage for most units and in many places we were wrong to do so already.
This commit is contained in:
@ -32,8 +32,8 @@ using namespace units;
|
||||
|
||||
namespace fps {
|
||||
|
||||
struct foot : named_unit<foot, "ft", no_prefix> {};
|
||||
struct yard : named_scaled_unit<yard, "yd", no_prefix, ratio(3), foot> {};
|
||||
struct foot : named_unit<foot, "ft"> {};
|
||||
struct yard : named_scaled_unit<yard, "yd", ratio(3), foot> {};
|
||||
|
||||
struct dim_length : base_dimension<"L", foot> {};
|
||||
|
||||
@ -44,7 +44,7 @@ using length = quantity<dim_length, U, Rep>;
|
||||
|
||||
namespace si {
|
||||
|
||||
struct metre : named_unit<metre, "m", units::isq::si::prefix> {};
|
||||
struct metre : named_unit<metre, "m"> {};
|
||||
struct kilometre : prefixed_unit<kilometre, units::isq::si::kilo, metre> {};
|
||||
|
||||
struct dim_length : base_dimension<"L", metre> {};
|
||||
@ -54,8 +54,8 @@ using length = quantity<dim_length, U, Rep>;
|
||||
|
||||
namespace fps {
|
||||
|
||||
struct foot : named_scaled_unit<foot, "ft", no_prefix, ratio(3'048, 1'000, -1), metre> {};
|
||||
struct yard : named_scaled_unit<yard, "yd", no_prefix, ratio(3), foot> {};
|
||||
struct foot : named_scaled_unit<foot, "ft", ratio(3'048, 1'000, -1), metre> {};
|
||||
struct yard : named_scaled_unit<yard, "yd", ratio(3), foot> {};
|
||||
|
||||
struct dim_length : base_dimension<"L", foot> {};
|
||||
|
||||
|
@ -32,7 +32,7 @@
|
||||
// TODO Fix when Celsius is properly supported (#232)
|
||||
namespace units::isq::si {
|
||||
|
||||
struct degree_celsius : alias_unit<kelvin, basic_symbol_text{"°C", "deg_C"}, no_prefix> {};
|
||||
struct degree_celsius : alias_unit<kelvin, basic_symbol_text{"°C", "deg_C"}> {};
|
||||
|
||||
namespace thermodynamic_temperature_references {
|
||||
|
||||
|
@ -32,7 +32,7 @@
|
||||
// TODO Fix when Celsius is properly supported (#232)
|
||||
namespace units::isq::si {
|
||||
|
||||
struct degree_celsius : alias_unit<kelvin, basic_symbol_text{"°C", "deg_C"}, no_prefix> {};
|
||||
struct degree_celsius : alias_unit<kelvin, basic_symbol_text{"°C", "deg_C"}> {};
|
||||
|
||||
namespace thermodynamic_temperature_references {
|
||||
|
||||
|
@ -32,7 +32,7 @@
|
||||
// TODO Fix when Celsius is properly supported (#232)
|
||||
namespace units::isq::si {
|
||||
|
||||
struct degree_celsius : alias_unit<kelvin, basic_symbol_text{"°C", "deg_C"}, no_prefix> {};
|
||||
struct degree_celsius : alias_unit<kelvin, basic_symbol_text{"°C", "deg_C"}> {};
|
||||
|
||||
namespace thermodynamic_temperature_references {
|
||||
|
||||
|
@ -32,8 +32,8 @@ using namespace units;
|
||||
|
||||
namespace fps {
|
||||
|
||||
struct foot : named_unit<foot, "ft", no_prefix> {};
|
||||
struct yard : named_scaled_unit<yard, "yd", no_prefix, ratio(3), foot> {};
|
||||
struct foot : named_unit<foot, "ft"> {};
|
||||
struct yard : named_scaled_unit<yard, "yd", ratio(3), foot> {};
|
||||
|
||||
struct dim_length : base_dimension<"L", foot> {};
|
||||
|
||||
@ -44,7 +44,7 @@ using length = quantity<dim_length, U, Rep>;
|
||||
|
||||
namespace si {
|
||||
|
||||
struct metre : named_unit<metre, "m", units::isq::si::prefix> {};
|
||||
struct metre : named_unit<metre, "m"> {};
|
||||
struct kilometre : prefixed_unit<kilometre, units::isq::si::kilo, metre> {};
|
||||
|
||||
struct dim_length : base_dimension<"L", metre> {};
|
||||
@ -54,8 +54,8 @@ using length = quantity<dim_length, U, Rep>;
|
||||
|
||||
namespace fps {
|
||||
|
||||
struct foot : named_scaled_unit<foot, "ft", no_prefix, ratio(3'048, 1'000, -1), metre> {};
|
||||
struct yard : named_scaled_unit<yard, "yd", no_prefix, ratio(3), foot> {};
|
||||
struct foot : named_scaled_unit<foot, "ft", ratio(3'048, 1'000, -1), metre> {};
|
||||
struct yard : named_scaled_unit<yard, "yd", ratio(3), foot> {};
|
||||
|
||||
struct dim_length : base_dimension<"L", foot> {};
|
||||
|
||||
|
@ -37,25 +37,14 @@
|
||||
|
||||
namespace units {
|
||||
|
||||
// PrefixFamily
|
||||
struct prefix_family;
|
||||
|
||||
/**
|
||||
* @brief A concept matching a prefix family
|
||||
*
|
||||
* Satisfied by all types derived from `prefix_family`
|
||||
*/
|
||||
template<typename T>
|
||||
concept PrefixFamily = std::derived_from<T, prefix_family>;
|
||||
|
||||
// Prefix
|
||||
namespace detail {
|
||||
|
||||
template<PrefixFamily PF, ratio R>
|
||||
template<ratio R>
|
||||
struct prefix_base;
|
||||
|
||||
template<PrefixFamily PF, ratio R>
|
||||
void to_prefix_base(const volatile prefix_base<PF, R>*);
|
||||
template<ratio R>
|
||||
void to_prefix_base(const volatile prefix_base<R>*);
|
||||
|
||||
} // namespace detail
|
||||
|
||||
|
@ -57,28 +57,19 @@ constexpr auto ratio_text()
|
||||
}
|
||||
}
|
||||
|
||||
template<ratio R, typename PrefixFamily, std::size_t SymbolLen>
|
||||
template<ratio R, std::size_t SymbolLen>
|
||||
constexpr auto prefix_or_ratio_text()
|
||||
{
|
||||
if constexpr (R.num == 1 && R.den == 1 && R.exp == 0) {
|
||||
// no ratio/prefix
|
||||
return basic_fixed_string("");
|
||||
} else {
|
||||
if constexpr (!is_same_v<PrefixFamily, no_prefix>) {
|
||||
// try to form a prefix
|
||||
using prefix = downcast<detail::prefix_base<PrefixFamily, R>>;
|
||||
// try to form a prefix
|
||||
using prefix = downcast<detail::prefix_base<R>>;
|
||||
|
||||
if constexpr (!is_same_v<prefix, prefix_base<PrefixFamily, R>>) {
|
||||
// print as a prefixed unit
|
||||
return prefix::symbol;
|
||||
} else {
|
||||
// print as a ratio of the coherent unit
|
||||
constexpr auto txt = ratio_text<R>();
|
||||
if constexpr (SymbolLen > 0 && txt.standard().size() > 0)
|
||||
return txt + basic_fixed_string(" ");
|
||||
else
|
||||
return txt;
|
||||
}
|
||||
if constexpr (!is_same_v<prefix, prefix_base<R>>) {
|
||||
// print as a prefixed unit
|
||||
return prefix::symbol;
|
||||
} else {
|
||||
// print as a ratio of the coherent unit
|
||||
constexpr auto txt = ratio_text<R>();
|
||||
@ -151,15 +142,13 @@ constexpr auto unit_text()
|
||||
// use predefined coherent unit symbol
|
||||
constexpr auto symbol_text = coherent_unit::symbol;
|
||||
constexpr auto prefix_txt =
|
||||
prefix_or_ratio_text<U::ratio / coherent_unit::ratio, typename U::reference::prefix_family,
|
||||
symbol_text.standard().size()>();
|
||||
prefix_or_ratio_text<U::ratio / coherent_unit::ratio, symbol_text.standard().size()>();
|
||||
return prefix_txt + symbol_text;
|
||||
} else {
|
||||
// use derived dimension ingredients to create a unit symbol
|
||||
constexpr auto symbol_text = derived_dimension_unit_text<Dim>();
|
||||
constexpr auto prefix_txt =
|
||||
prefix_or_ratio_text<U::ratio / coherent_unit::ratio, typename U::reference::prefix_family,
|
||||
symbol_text.standard().size()>();
|
||||
prefix_or_ratio_text<U::ratio / coherent_unit::ratio, symbol_text.standard().size()>();
|
||||
return prefix_txt + symbol_text;
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,7 @@
|
||||
|
||||
namespace units {
|
||||
|
||||
struct radian : named_unit<radian, "rad", isq::si::prefix> {};
|
||||
struct radian : named_unit<radian, "rad"> {};
|
||||
|
||||
template<Unit U = radian>
|
||||
struct dim_angle : base_dimension<"A", U> {};
|
||||
|
@ -30,8 +30,8 @@
|
||||
|
||||
namespace units {
|
||||
|
||||
struct one : named_unit<one, "", no_prefix> {};
|
||||
struct percent : named_scaled_unit<percent, "%", no_prefix, ratio(1, 100), one> {};
|
||||
struct one : named_unit<one, ""> {};
|
||||
struct percent : named_scaled_unit<percent, "%", ratio(1, 100), one> {};
|
||||
|
||||
/**
|
||||
* @brief Dimension one
|
||||
|
@ -31,26 +31,10 @@
|
||||
|
||||
namespace units {
|
||||
|
||||
/**
|
||||
* @brief The base for all prefix families
|
||||
*
|
||||
* Every prefix family should inherit from this type to satisfy PrefixFamily concept.
|
||||
*/
|
||||
struct prefix_family {};
|
||||
|
||||
/**
|
||||
* @brief No prefix possible for the unit
|
||||
*
|
||||
* This is a special prefix type tag specifying that the unit can not be scaled with any kind
|
||||
* of the prefix.
|
||||
*/
|
||||
struct no_prefix : prefix_family {};
|
||||
|
||||
namespace detail {
|
||||
|
||||
template<PrefixFamily PF, ratio R>
|
||||
struct prefix_base : downcast_base<prefix_base<PF, R>> {
|
||||
using prefix_family = PF;
|
||||
template<ratio R>
|
||||
struct prefix_base : downcast_base<prefix_base<R>> {
|
||||
static constexpr ::units::ratio ratio = R;
|
||||
};
|
||||
|
||||
@ -63,17 +47,14 @@ struct prefix_base : downcast_base<prefix_base<PF, R>> {
|
||||
* - when defining a prefixed_unit its ratio is used to scale the reference unit and its
|
||||
* symbol is used to prepend to the symbol of referenced unit
|
||||
* - when printing the symbol of a scaled unit that was not predefined by the user but its
|
||||
* factor matches ratio of a prefix from the specified prefix family, its symbol will be
|
||||
* prepended to the symbol of the unit
|
||||
* factor matches ratio of a prefix, its symbol will be prepended to the symbol of the unit
|
||||
*
|
||||
* @tparam Child inherited class type used by the downcasting facility (CRTP Idiom)
|
||||
* @tparam PF a type of prefix family
|
||||
* @tparam Symbol a text representation of the prefix
|
||||
* @tparam R factor to be used to scale a unit
|
||||
*/
|
||||
template<typename Child, PrefixFamily PF, basic_symbol_text Symbol, ratio R>
|
||||
requires(!std::same_as<PF, no_prefix>)
|
||||
struct prefix : downcast_dispatch<Child, detail::prefix_base<PF, R>, downcast_mode::on> {
|
||||
template<typename Child, basic_symbol_text Symbol, ratio R>
|
||||
struct prefix : downcast_dispatch<Child, detail::prefix_base<R>, downcast_mode::on> {
|
||||
static constexpr auto symbol = Symbol;
|
||||
};
|
||||
|
||||
|
@ -35,6 +35,13 @@
|
||||
|
||||
namespace units {
|
||||
|
||||
namespace detail {
|
||||
|
||||
template<typename>
|
||||
inline constexpr bool can_be_prefixed = false;
|
||||
|
||||
} // namespace detail
|
||||
|
||||
/**
|
||||
* @brief A common point for a hierarchy of units
|
||||
*
|
||||
@ -69,39 +76,31 @@ struct same_unit_reference : is_same<typename U1::reference, typename U2::refere
|
||||
* @brief A named unit
|
||||
*
|
||||
* Defines a named (in most cases coherent) unit that is then passed to a dimension definition.
|
||||
* A named unit may be used by other units defined with the prefix of the same type, unless
|
||||
* no_prefix is provided for PF template parameter (in such a case it is impossible to define
|
||||
* a prefix unit based on this one).
|
||||
* A named unit may be composed with a prefix to create a prefixed_unit.
|
||||
*
|
||||
* @tparam Child inherited class type used by the downcasting facility (CRTP Idiom)
|
||||
* @tparam Symbol a short text representation of the unit
|
||||
* @tparam PF no_prefix or a type of prefix family
|
||||
*/
|
||||
template<typename Child, basic_symbol_text Symbol, PrefixFamily PF>
|
||||
template<typename Child, basic_symbol_text Symbol>
|
||||
struct named_unit : downcast_dispatch<Child, scaled_unit<ratio(1), Child>> {
|
||||
static constexpr auto symbol = Symbol;
|
||||
using prefix_family = PF;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief A scaled unit
|
||||
* @brief A named scaled unit
|
||||
*
|
||||
* Defines a new named unit that is a scaled version of another unit. Such unit can be used by
|
||||
* other units defined with the prefix of the same type, unless no_prefix is provided for PF
|
||||
* template parameter (in such a case it is impossible to define a prefix unit based on this
|
||||
* one).
|
||||
* Defines a new named unit that is a scaled version of another unit.
|
||||
* A named unit may be composed with a prefix to create a prefixed_unit.
|
||||
*
|
||||
* @tparam Child inherited class type used by the downcasting facility (CRTP Idiom)
|
||||
* @tparam Symbol a short text representation of the unit
|
||||
* @tparam PF no_prefix or a type of prefix family
|
||||
* @tparam R a scale to apply to U
|
||||
* @tparam U a reference unit to scale
|
||||
*/
|
||||
template<typename Child, basic_symbol_text Symbol, PrefixFamily PF, ratio R, Unit U>
|
||||
template<typename Child, basic_symbol_text Symbol, ratio R, Unit U>
|
||||
requires UnitRatio<R>
|
||||
struct named_scaled_unit : downcast_dispatch<Child, scaled_unit<R * U::ratio, typename U::reference>> {
|
||||
static constexpr auto symbol = Symbol;
|
||||
using prefix_family = PF;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -116,10 +115,9 @@ struct named_scaled_unit : downcast_dispatch<Child, scaled_unit<R * U::ratio, ty
|
||||
* @tparam U reference unit
|
||||
*/
|
||||
template<typename Child, Prefix P, NamedUnit U>
|
||||
requires std::same_as<typename P::prefix_family, typename U::prefix_family>
|
||||
requires detail::can_be_prefixed<U>
|
||||
struct prefixed_unit : downcast_dispatch<Child, scaled_unit<P::ratio * U::ratio, typename U::reference>> {
|
||||
static constexpr auto symbol = P::symbol + U::symbol;
|
||||
using prefix_family = no_prefix;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -131,9 +129,7 @@ struct prefixed_unit : downcast_dispatch<Child, scaled_unit<P::ratio * U::ratio,
|
||||
* @tparam Child inherited class type used by the downcasting facility (CRTP Idiom)
|
||||
*/
|
||||
template<typename Child>
|
||||
struct derived_unit : downcast_dispatch<Child, scaled_unit<ratio(1), Child>> {
|
||||
using prefix_family = no_prefix;
|
||||
};
|
||||
struct derived_unit : downcast_dispatch<Child, scaled_unit<ratio(1), Child>> {};
|
||||
|
||||
/**
|
||||
* @brief A unit with a deduced ratio and symbol
|
||||
@ -152,7 +148,6 @@ template<typename Child, DerivedDimension Dim, NamedUnit U, NamedUnit... URest>
|
||||
requires detail::same_scaled_units<typename Dim::recipe, U, URest...>
|
||||
struct derived_deduced_unit : downcast_dispatch<Child, detail::derived_deduced_unit<Dim, U, URest...>> {
|
||||
static constexpr auto symbol = detail::derived_symbol_text<Dim, U, URest...>();
|
||||
using prefix_family = no_prefix;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -160,18 +155,14 @@ struct derived_deduced_unit : downcast_dispatch<Child, detail::derived_deduced_u
|
||||
*
|
||||
* Defines a named alias for another unit. It is useful to assign alternative names and symbols
|
||||
* to the already predefined units (i.e. "tonne" for "megagram").
|
||||
* An alias unit may be used by other units defined with the prefix of the same type, unless
|
||||
* no_prefix is provided for PF template parameter (in such a case it is impossible to define
|
||||
* a prefix unit based on this one).
|
||||
* A alias unit may be composed with a prefix to create a prefixed_alias_unit.
|
||||
*
|
||||
* @tparam U Unit for which an alias is defined
|
||||
* @tparam Symbol a short text representation of the unit
|
||||
* @tparam PF no_prefix or a type of prefix family
|
||||
*/
|
||||
template<Unit U, basic_symbol_text Symbol, PrefixFamily PF>
|
||||
template<Unit U, basic_symbol_text Symbol>
|
||||
struct alias_unit : U {
|
||||
static constexpr auto symbol = Symbol;
|
||||
using prefix_family = PF;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -188,16 +179,15 @@ struct alias_unit : U {
|
||||
// TODO gcc bug: 95015
|
||||
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95015
|
||||
// template<Unit U, Prefix P, AliasUnit AU>
|
||||
// requires (!AliasUnit<U>) && std::same_as<typename P::prefix_family, typename AU::prefix_family>
|
||||
// requires (!AliasUnit<U>)
|
||||
template<Unit U, Prefix P, NamedUnit AU>
|
||||
requires std::same_as<typename P::prefix_family, typename AU::prefix_family>
|
||||
requires detail::can_be_prefixed<AU>
|
||||
struct prefixed_alias_unit : U {
|
||||
static constexpr auto symbol = P::symbol + AU::symbol;
|
||||
using prefix_family = no_prefix;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Unknown unit
|
||||
* @brief Unknown coherent unit
|
||||
*
|
||||
* Used as a coherent unit of an unknown dimension.
|
||||
*/
|
||||
@ -205,17 +195,17 @@ struct unknown_coherent_unit : derived_unit<unknown_coherent_unit> {};
|
||||
|
||||
namespace detail {
|
||||
|
||||
template<typename Child, basic_symbol_text Symbol, PrefixFamily PF>
|
||||
void is_named_impl(const volatile named_unit<Child, Symbol, PF>*);
|
||||
template<typename Child, basic_symbol_text Symbol>
|
||||
void is_named_impl(const volatile named_unit<Child, Symbol>*);
|
||||
|
||||
template<typename Child, basic_symbol_text Symbol, PrefixFamily PF, ratio R, Unit U>
|
||||
void is_named_impl(const volatile named_scaled_unit<Child, Symbol, PF, R, U>*);
|
||||
template<typename Child, basic_symbol_text Symbol, ratio R, typename U>
|
||||
void is_named_impl(const volatile named_scaled_unit<Child, Symbol, R, U>*);
|
||||
|
||||
template<typename Child, typename P, typename U>
|
||||
void is_named_impl(const volatile prefixed_unit<Child, P, U>*);
|
||||
|
||||
template<Unit U, basic_symbol_text Symbol, PrefixFamily PF>
|
||||
void is_named_impl(const volatile alias_unit<U, Symbol, PF>*);
|
||||
template<typename U, basic_symbol_text Symbol>
|
||||
void is_named_impl(const volatile alias_unit<U, Symbol>*);
|
||||
|
||||
template<typename U, typename P, typename AU>
|
||||
void is_named_impl(const volatile prefixed_alias_unit<U, P, AU>*);
|
||||
@ -223,6 +213,18 @@ void is_named_impl(const volatile prefixed_alias_unit<U, P, AU>*);
|
||||
template<Unit U>
|
||||
inline constexpr bool is_named<U> = requires(U * u) { is_named_impl(u); };
|
||||
|
||||
template<typename Child, basic_symbol_text Symbol>
|
||||
void can_be_prefixed_impl(const volatile named_unit<Child, Symbol>*);
|
||||
|
||||
template<typename Child, basic_symbol_text Symbol, ratio R, typename U>
|
||||
void can_be_prefixed_impl(const volatile named_scaled_unit<Child, Symbol, R, U>*);
|
||||
|
||||
template<typename U, basic_symbol_text Symbol>
|
||||
void can_be_prefixed_impl(const volatile alias_unit<U, Symbol>*);
|
||||
|
||||
template<Unit U>
|
||||
inline constexpr bool can_be_prefixed<U> = requires(U * u) { can_be_prefixed_impl(u); };
|
||||
|
||||
} // namespace detail
|
||||
|
||||
} // namespace units
|
||||
|
@ -26,13 +26,11 @@
|
||||
|
||||
namespace units::isq::iec80000 {
|
||||
|
||||
struct binary_prefix : prefix_family {};
|
||||
|
||||
struct kibi : units::prefix<kibi, binary_prefix, "Ki", ratio(1'024)> {};
|
||||
struct mebi : units::prefix<mebi, binary_prefix, "Mi", ratio(1'048'576)> {};
|
||||
struct gibi : units::prefix<gibi, binary_prefix, "Gi", ratio(1'073'741'824)> {};
|
||||
struct tebi : units::prefix<tebi, binary_prefix, "Ti", ratio(1'099'511'627'776)> {};
|
||||
struct pebi : units::prefix<pebi, binary_prefix, "Pi", ratio(1'125'899'906'842'624)> {};
|
||||
struct exbi : units::prefix<exbi, binary_prefix, "Ei", ratio(1'152'921'504'606'846'976)> {};
|
||||
struct kibi : units::prefix<kibi, "Ki", ratio(1'024)> {};
|
||||
struct mebi : units::prefix<mebi, "Mi", ratio(1'048'576)> {};
|
||||
struct gibi : units::prefix<gibi, "Gi", ratio(1'073'741'824)> {};
|
||||
struct tebi : units::prefix<tebi, "Ti", ratio(1'099'511'627'776)> {};
|
||||
struct pebi : units::prefix<pebi, "Pi", ratio(1'125'899'906'842'624)> {};
|
||||
struct exbi : units::prefix<exbi, "Ei", ratio(1'152'921'504'606'846'976)> {};
|
||||
|
||||
} // namespace units::isq::iec80000
|
||||
|
@ -34,7 +34,7 @@
|
||||
|
||||
namespace units::isq::iec80000 {
|
||||
|
||||
struct baud : alias_unit<si::hertz, "Bd", si::prefix> {};
|
||||
struct baud : alias_unit<si::hertz, "Bd"> {};
|
||||
struct kilobaud : prefixed_alias_unit<si::kilohertz, si::kilo, baud> {};
|
||||
struct megabaud : prefixed_alias_unit<si::megahertz, si::mega, baud> {};
|
||||
struct gigabaud : prefixed_alias_unit<si::gigahertz, si::giga, baud> {};
|
||||
|
@ -35,7 +35,8 @@
|
||||
|
||||
namespace units::isq::iec80000 {
|
||||
|
||||
struct bit : named_unit<bit, "bit", si::prefix> {};
|
||||
struct bit : named_unit<bit, "bit"> {};
|
||||
|
||||
struct kilobit : prefixed_unit<kilobit, si::kilo, bit> {};
|
||||
struct megabit : prefixed_unit<megabit, si::mega, bit> {};
|
||||
struct gigabit : prefixed_unit<gigabit, si::giga, bit> {};
|
||||
@ -45,15 +46,15 @@ struct exabit : prefixed_unit<exabit, si::exa, bit> {};
|
||||
struct zettabit : prefixed_unit<zettabit, si::zetta, bit> {};
|
||||
struct yottabit : prefixed_unit<yottabit, si::yotta, bit> {};
|
||||
|
||||
struct binary_prefix_bit : alias_unit<bit, "bit", binary_prefix> {};
|
||||
struct kibibit : prefixed_unit<kibibit, kibi, binary_prefix_bit> {};
|
||||
struct mebibit : prefixed_unit<mebibit, mebi, binary_prefix_bit> {};
|
||||
struct gibibit : prefixed_unit<gibibit, gibi, binary_prefix_bit> {};
|
||||
struct tebibit : prefixed_unit<tebibit, tebi, binary_prefix_bit> {};
|
||||
struct pebibit : prefixed_unit<pebibit, pebi, binary_prefix_bit> {};
|
||||
struct exbibit : prefixed_unit<exbibit, exbi, binary_prefix_bit> {};
|
||||
struct kibibit : prefixed_unit<kibibit, kibi, bit> {};
|
||||
struct mebibit : prefixed_unit<mebibit, mebi, bit> {};
|
||||
struct gibibit : prefixed_unit<gibibit, gibi, bit> {};
|
||||
struct tebibit : prefixed_unit<tebibit, tebi, bit> {};
|
||||
struct pebibit : prefixed_unit<pebibit, pebi, bit> {};
|
||||
struct exbibit : prefixed_unit<exbibit, exbi, bit> {};
|
||||
|
||||
struct byte : named_scaled_unit<byte, "B", ratio(8), bit> {};
|
||||
|
||||
struct byte : named_scaled_unit<byte, "B", si::prefix, ratio(8), bit> {};
|
||||
struct kilobyte : prefixed_unit<kilobyte, si::kilo, byte> {};
|
||||
struct megabyte : prefixed_unit<megabyte, si::mega, byte> {};
|
||||
struct gigabyte : prefixed_unit<gigabyte, si::giga, byte> {};
|
||||
@ -63,13 +64,12 @@ struct exabyte : prefixed_unit<exabyte, si::exa, byte> {};
|
||||
struct zettabyte : prefixed_unit<zettabyte, si::zetta, byte> {};
|
||||
struct yottabyte : prefixed_unit<yottabyte, si::yotta, byte> {};
|
||||
|
||||
struct binary_prefix_byte : alias_unit<byte, "B", binary_prefix> {};
|
||||
struct kibibyte : prefixed_unit<kibibyte, kibi, binary_prefix_byte> {};
|
||||
struct mebibyte : prefixed_unit<mebibyte, mebi, binary_prefix_byte> {};
|
||||
struct gibibyte : prefixed_unit<gibibyte, gibi, binary_prefix_byte> {};
|
||||
struct tebibyte : prefixed_unit<tebibyte, tebi, binary_prefix_byte> {};
|
||||
struct pebibyte : prefixed_unit<pebibyte, pebi, binary_prefix_byte> {};
|
||||
// struct exbibyte : prefixed_unit<exbibyte, exbi, binary_prefix_byte> {};
|
||||
struct kibibyte : prefixed_unit<kibibyte, kibi, byte> {};
|
||||
struct mebibyte : prefixed_unit<mebibyte, mebi, byte> {};
|
||||
struct gibibyte : prefixed_unit<gibibyte, gibi, byte> {};
|
||||
struct tebibyte : prefixed_unit<tebibyte, tebi, byte> {};
|
||||
struct pebibyte : prefixed_unit<pebibyte, pebi, byte> {};
|
||||
// struct exbibyte : prefixed_unit<exbibyte, exbi, byte> {};
|
||||
|
||||
struct dim_storage_capacity : base_dimension<"M", byte> {};
|
||||
|
||||
|
@ -33,7 +33,7 @@
|
||||
|
||||
namespace units::isq::iec80000 {
|
||||
|
||||
struct erlang : named_unit<erlang, "E", no_prefix> {};
|
||||
struct erlang : named_unit<erlang, "E"> {};
|
||||
|
||||
struct dim_traffic_intensity : base_dimension<"A", erlang> {};
|
||||
|
||||
|
@ -31,11 +31,10 @@
|
||||
|
||||
namespace units::isq::natural {
|
||||
|
||||
struct electronvolt : named_unit<electronvolt, "eV", si::prefix> {};
|
||||
struct electronvolt : named_unit<electronvolt, "eV"> {};
|
||||
struct gigaelectronvolt : prefixed_unit<gigaelectronvolt, si::giga, electronvolt> {};
|
||||
struct inverted_gigaelectronvolt :
|
||||
named_unit<inverted_gigaelectronvolt, basic_symbol_text{"GeV⁻¹", "GeV^-1"}, no_prefix> {};
|
||||
struct square_gigaelectronvolt : named_unit<square_gigaelectronvolt, basic_symbol_text{"GeV²", "GeV^2"}, no_prefix> {};
|
||||
struct inverted_gigaelectronvolt : named_unit<inverted_gigaelectronvolt, basic_symbol_text{"GeV⁻¹", "GeV^-1"}> {};
|
||||
struct square_gigaelectronvolt : named_unit<square_gigaelectronvolt, basic_symbol_text{"GeV²", "GeV^2"}> {};
|
||||
|
||||
// NOTE: eV as a base unit with no relation to joule prevents us from going back
|
||||
// from natural units to SI. Do we need such a support or should we treat
|
||||
|
@ -34,7 +34,7 @@
|
||||
|
||||
namespace units::isq::si::cgs {
|
||||
|
||||
struct gal : named_unit<gal, "Gal", si::prefix> {};
|
||||
struct gal : named_unit<gal, "Gal"> {};
|
||||
struct dim_acceleration : isq::dim_acceleration<dim_acceleration, gal, dim_length, dim_time> {};
|
||||
|
||||
template<UnitOf<dim_acceleration> U, Representation Rep = double>
|
||||
|
@ -35,7 +35,7 @@
|
||||
|
||||
namespace units::isq::si::cgs {
|
||||
|
||||
struct erg : named_unit<erg, "erg", si::prefix> {};
|
||||
struct erg : named_unit<erg, "erg"> {};
|
||||
|
||||
struct dim_energy : isq::dim_energy<dim_energy, erg, dim_force, dim_length> {};
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
||||
|
||||
namespace units::isq::si::cgs {
|
||||
|
||||
struct dyne : named_unit<dyne, "dyn", si::prefix> {};
|
||||
struct dyne : named_unit<dyne, "dyn"> {};
|
||||
|
||||
struct dim_force : isq::dim_force<dim_force, dyne, dim_mass, dim_acceleration> {};
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
||||
|
||||
namespace units::isq::si::cgs {
|
||||
|
||||
struct barye : named_unit<barye, "Ba", si::prefix> {};
|
||||
struct barye : named_unit<barye, "Ba"> {};
|
||||
|
||||
struct dim_pressure : isq::dim_pressure<dim_pressure, barye, dim_force, dim_area> {};
|
||||
|
||||
|
@ -37,15 +37,15 @@
|
||||
namespace units::isq::si::fps {
|
||||
|
||||
// https://en.wikipedia.org/wiki/Poundal
|
||||
struct poundal : named_unit<poundal, "pdl", no_prefix> {};
|
||||
struct poundal : named_unit<poundal, "pdl"> {};
|
||||
|
||||
// https://en.wikipedia.org/wiki/Pound_(force)
|
||||
struct pound_force : named_scaled_unit<pound_force, "lbf", si::prefix, ratio(32'174'049, 1'000'000), poundal> {};
|
||||
struct pound_force : named_scaled_unit<pound_force, "lbf", ratio(32'174'049, 1'000'000), poundal> {};
|
||||
|
||||
struct kilopound_force : prefixed_unit<kilopound_force, si::kilo, pound_force> {};
|
||||
|
||||
// https://en.wikipedia.org/wiki/Kip_(unit),
|
||||
struct kip : alias_unit<kilopound_force, "klbf", no_prefix> {};
|
||||
struct kip : alias_unit<kilopound_force, "klbf"> {};
|
||||
|
||||
struct dim_force : isq::dim_force<dim_force, poundal, dim_mass, dim_acceleration> {};
|
||||
|
||||
|
@ -43,13 +43,13 @@ using si::international::thou;
|
||||
using si::international::yard;
|
||||
|
||||
// thousandth of an inch
|
||||
struct thousandth : alias_unit<thou, "thou", no_prefix> {};
|
||||
struct thousandth : alias_unit<thou, "thou"> {};
|
||||
|
||||
struct kiloyard : prefixed_unit<kiloyard, si::kilo, yard> {};
|
||||
|
||||
struct mile : named_scaled_unit<mile, "mile", no_prefix, ratio(5'280), foot> {};
|
||||
struct mile : named_scaled_unit<mile, "mile", ratio(5'280), foot> {};
|
||||
|
||||
struct nautical_mile : named_scaled_unit<nautical_mile, "nmi", no_prefix, ratio(2'000), yard> {};
|
||||
struct nautical_mile : named_scaled_unit<nautical_mile, "nmi", ratio(2'000), yard> {};
|
||||
|
||||
struct dim_length : isq::dim_length<foot> {};
|
||||
|
||||
|
@ -35,28 +35,28 @@
|
||||
namespace units::isq::si::fps {
|
||||
|
||||
// https://en.wikipedia.org/wiki/Pound_(mass)
|
||||
struct pound : named_scaled_unit<pound, "lb", no_prefix, ratio(45'359'237, 100'000'000), si::kilogram> {};
|
||||
struct pound : named_scaled_unit<pound, "lb", ratio(45'359'237, 100'000'000), si::kilogram> {};
|
||||
|
||||
struct dim_mass : isq::dim_mass<pound> {};
|
||||
|
||||
template<UnitOf<dim_mass> U, Representation Rep = double>
|
||||
using mass = quantity<dim_mass, U, Rep>;
|
||||
|
||||
struct grain : named_scaled_unit<grain, "gr", no_prefix, ratio(1, 7000), pound> {};
|
||||
struct grain : named_scaled_unit<grain, "gr", ratio(1, 7000), pound> {};
|
||||
|
||||
struct dram : named_scaled_unit<dram, "dr", no_prefix, ratio(1, 256), pound> {};
|
||||
struct dram : named_scaled_unit<dram, "dr", ratio(1, 256), pound> {};
|
||||
|
||||
struct ounce : named_scaled_unit<ounce, "oz", no_prefix, ratio(1, 16), pound> {};
|
||||
struct ounce : named_scaled_unit<ounce, "oz", ratio(1, 16), pound> {};
|
||||
|
||||
struct stone : named_scaled_unit<stone, "st", no_prefix, ratio(14, 1), pound> {};
|
||||
struct stone : named_scaled_unit<stone, "st", ratio(14, 1), pound> {};
|
||||
|
||||
struct quarter : named_scaled_unit<quarter, "qr", no_prefix, ratio(28, 1), pound> {};
|
||||
struct quarter : named_scaled_unit<quarter, "qr", ratio(28, 1), pound> {};
|
||||
|
||||
struct hundredweight : named_scaled_unit<hundredweight, "cwt", no_prefix, ratio(112, 1), pound> {};
|
||||
struct hundredweight : named_scaled_unit<hundredweight, "cwt", ratio(112, 1), pound> {};
|
||||
|
||||
struct short_ton : named_scaled_unit<short_ton, "ton (short)", no_prefix, ratio(2'000, 1), pound> {};
|
||||
struct short_ton : named_scaled_unit<short_ton, "ton (short)", ratio(2'000, 1), pound> {};
|
||||
|
||||
struct long_ton : named_scaled_unit<long_ton, "ton (long)", no_prefix, ratio(2'240, 1), pound> {};
|
||||
struct long_ton : named_scaled_unit<long_ton, "ton (long)", ratio(2'240, 1), pound> {};
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
|
@ -42,7 +42,7 @@ struct dim_power : isq::dim_power<dim_power, foot_poundal_per_second, dim_length
|
||||
struct foot_pound_force_per_second :
|
||||
derived_deduced_unit<foot_pound_force_per_second, dim_power, foot, pound_force, second> {};
|
||||
|
||||
struct horse_power : named_scaled_unit<horse_power, "hp", no_prefix, ratio(550), foot_pound_force_per_second> {};
|
||||
struct horse_power : named_scaled_unit<horse_power, "hp", ratio(550), foot_pound_force_per_second> {};
|
||||
|
||||
template<UnitOf<dim_power> U, Representation Rep = double>
|
||||
using power = quantity<dim_power, U, Rep>;
|
||||
|
@ -44,11 +44,10 @@ template<UnitOf<dim_pressure> U, Representation Rep = double>
|
||||
using pressure = quantity<dim_pressure, U, Rep>;
|
||||
|
||||
struct pound_force_per_foot_sq :
|
||||
named_scaled_unit<pound_force_per_foot_sq, "lbf ft2", si::prefix, ratio(32'174'049, 1'000'000),
|
||||
poundal_per_foot_sq> {};
|
||||
named_scaled_unit<pound_force_per_foot_sq, "lbf ft2", ratio(32'174'049, 1'000'000), poundal_per_foot_sq> {};
|
||||
|
||||
struct pound_force_per_inch_sq :
|
||||
named_scaled_unit<pound_force_per_inch_sq, "psi", si::prefix, ratio(1, 144), pound_force_per_foot_sq> {};
|
||||
named_scaled_unit<pound_force_per_inch_sq, "psi", ratio(1, 144), pound_force_per_foot_sq> {};
|
||||
|
||||
struct kilopound_force_per_inch_sq : prefixed_unit<kilopound_force_per_inch_sq, si::kilo, pound_force_per_inch_sq> {};
|
||||
|
||||
|
@ -43,7 +43,7 @@ using speed = quantity<dim_speed, U, Rep>;
|
||||
|
||||
struct mile_per_hour : derived_deduced_unit<mile_per_hour, dim_speed, mile, hour> {};
|
||||
struct nautical_mile_per_hour : derived_deduced_unit<nautical_mile_per_hour, dim_speed, nautical_mile, hour> {};
|
||||
struct knot : alias_unit<nautical_mile_per_hour, "kn", no_prefix> {};
|
||||
struct knot : alias_unit<nautical_mile_per_hour, "kn"> {};
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
|
@ -37,7 +37,7 @@ namespace units::isq::si::hep {
|
||||
// effective cross-sectional area according to EU council directive 80/181/EEC
|
||||
// https://eur-lex.europa.eu/legal-content/EN/TXT/PDF/?uri=CELEX:01980L0181-20090527#page=10
|
||||
// https://www.fedlex.admin.ch/eli/cc/1994/3109_3109_3109/de
|
||||
struct barn : named_scaled_unit<barn, "b", prefix, ratio(1, 1, -28), square_metre> {};
|
||||
struct barn : named_scaled_unit<barn, "b", ratio(1, 1, -28), square_metre> {};
|
||||
struct yocto_barn : prefixed_unit<yocto_barn, yocto, barn> {};
|
||||
struct zepto_barn : prefixed_unit<zepto_barn, zepto, barn> {};
|
||||
struct atto_barn : prefixed_unit<atto_barn, atto, barn> {};
|
||||
|
@ -35,7 +35,7 @@
|
||||
namespace units::isq::si::hep {
|
||||
|
||||
struct eV_per_c2 :
|
||||
named_scaled_unit<eV_per_c2, basic_symbol_text{"eV/c²", "eV/c^2"}, prefix,
|
||||
named_scaled_unit<eV_per_c2, basic_symbol_text{"eV/c²", "eV/c^2"},
|
||||
ratio(1'7826'619'216'279, 1'000'000'000'000, -35), kilogram> {};
|
||||
struct feV_per_c2 : prefixed_unit<feV_per_c2, femto, eV_per_c2> {};
|
||||
struct peV_per_c2 : prefixed_unit<peV_per_c2, pico, eV_per_c2> {};
|
||||
@ -52,11 +52,10 @@ struct PeV_per_c2 : prefixed_unit<PeV_per_c2, peta, eV_per_c2> {};
|
||||
struct EeV_per_c2 : prefixed_unit<EeV_per_c2, exa, eV_per_c2> {};
|
||||
struct YeV_per_c2 : prefixed_unit<YeV_per_c2, yotta, eV_per_c2> {};
|
||||
struct electron_mass :
|
||||
named_scaled_unit<eV_per_c2, "m_e", prefix, ratio(9'109'383'701'528, 1'000'000'000'000, -31), kilogram> {};
|
||||
struct proton_mass :
|
||||
named_scaled_unit<eV_per_c2, "m_p", prefix, ratio(1'672'621'923'695, 1'000'000'000'000, -27), kilogram> {};
|
||||
named_scaled_unit<eV_per_c2, "m_e", ratio(9'109'383'701'528, 1'000'000'000'000, -31), kilogram> {};
|
||||
struct proton_mass : named_scaled_unit<eV_per_c2, "m_p", ratio(1'672'621'923'695, 1'000'000'000'000, -27), kilogram> {};
|
||||
struct neutron_mass :
|
||||
named_scaled_unit<eV_per_c2, "m_n", prefix, ratio(1'674'927'498'049, 1'000'000'000'000, -27), kilogram> {};
|
||||
named_scaled_unit<eV_per_c2, "m_n", ratio(1'674'927'498'049, 1'000'000'000'000, -27), kilogram> {};
|
||||
|
||||
struct dim_mass : isq::dim_mass<eV_per_c2> {};
|
||||
|
||||
|
@ -37,8 +37,7 @@ namespace units::isq::si::hep {
|
||||
struct kilogram_metre_per_second : derived_unit<kilogram_metre_per_second> {};
|
||||
|
||||
struct eV_per_c :
|
||||
named_scaled_unit<eV_per_c, "eV/c", prefix, ratio(5'344'285'992'678, 1'000'000'000'000, -35),
|
||||
kilogram_metre_per_second> {};
|
||||
named_scaled_unit<eV_per_c, "eV/c", ratio(5'344'285'992'678, 1'000'000'000'000, -35), kilogram_metre_per_second> {};
|
||||
struct feV_per_c : prefixed_unit<feV_per_c, femto, eV_per_c> {};
|
||||
struct peV_per_c : prefixed_unit<peV_per_c, pico, eV_per_c> {};
|
||||
struct neV_per_c : prefixed_unit<neV_per_c, nano, eV_per_c> {};
|
||||
|
@ -36,13 +36,13 @@
|
||||
namespace units::isq::si::iau {
|
||||
|
||||
// https://en.wikipedia.org/wiki/Light-year
|
||||
struct light_year : named_scaled_unit<light_year, "ly", no_prefix, ratio(9460730472580800), si::metre> {};
|
||||
struct light_year : named_scaled_unit<light_year, "ly", ratio(9460730472580800), si::metre> {};
|
||||
|
||||
// https://en.wikipedia.org/wiki/Parsec
|
||||
struct parsec : named_scaled_unit<parsec, "pc", si::prefix, ratio(30'856'775'814'913'673), si::metre> {};
|
||||
struct parsec : named_scaled_unit<parsec, "pc", ratio(30'856'775'814'913'673), si::metre> {};
|
||||
|
||||
// https://en.wikipedia.org/wiki/Angstrom
|
||||
struct angstrom : named_scaled_unit<angstrom, "angstrom", no_prefix, ratio(1, 1, -10), si::metre> {};
|
||||
struct angstrom : named_scaled_unit<angstrom, "angstrom", ratio(1, 1, -10), si::metre> {};
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
|
@ -35,10 +35,10 @@
|
||||
namespace units::isq::si::imperial {
|
||||
|
||||
// https://en.wikipedia.org/wiki/Chain_(unit)
|
||||
struct chain : named_scaled_unit<chain, "ch", no_prefix, ratio(22, 1), si::international::yard> {};
|
||||
struct chain : named_scaled_unit<chain, "ch", ratio(22, 1), si::international::yard> {};
|
||||
|
||||
// https://en.wikipedia.org/wiki/Rod_(unit)
|
||||
struct rod : named_scaled_unit<rod, "rd", no_prefix, ratio(1, 4), chain> {};
|
||||
struct rod : named_scaled_unit<rod, "rd", ratio(1, 4), chain> {};
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
|
@ -37,30 +37,30 @@ namespace units::isq::si::international {
|
||||
|
||||
// si::international yard
|
||||
// https://en.wikipedia.org/wiki/International_yard_and_pound
|
||||
struct yard : named_scaled_unit<yard, "yd", si::prefix, ratio(9'144, 1'000, -1), si::metre> {};
|
||||
struct yard : named_scaled_unit<yard, "yd", ratio(9'144, 1'000, -1), si::metre> {};
|
||||
|
||||
// si::international foot
|
||||
// https://en.wikipedia.org/wiki/Foot_(unit)#International_foot
|
||||
struct foot : named_scaled_unit<foot, "ft", no_prefix, ratio(1, 3), yard> {};
|
||||
struct foot : named_scaled_unit<foot, "ft", ratio(1, 3), yard> {};
|
||||
|
||||
// https://en.wikipedia.org/wiki/Fathom#International_fathom
|
||||
struct fathom : named_scaled_unit<fathom, "fathom", no_prefix, ratio(2), yard> {};
|
||||
struct fathom : named_scaled_unit<fathom, "fathom", ratio(2), yard> {};
|
||||
|
||||
// si::international inch
|
||||
// https://en.wikipedia.org/wiki/Inch#Equivalences
|
||||
struct inch : named_scaled_unit<inch, "in", no_prefix, ratio(1, 36), yard> {};
|
||||
struct inch : named_scaled_unit<inch, "in", ratio(1, 36), yard> {};
|
||||
|
||||
// intrnational mile
|
||||
// https://en.wikipedia.org/wiki/Mile#International_mile
|
||||
struct mile : named_scaled_unit<mile, "mi", no_prefix, ratio(25'146, 15'625), si::kilometre> {};
|
||||
struct mile : named_scaled_unit<mile, "mi", ratio(25'146, 15'625), si::kilometre> {};
|
||||
|
||||
// si::international nautical mile
|
||||
// https://en.wikipedia.org/wiki/Nautical_mile
|
||||
struct nautical_mile : named_scaled_unit<nautical_mile, "nmi", no_prefix, ratio(1852), si::metre> {};
|
||||
struct nautical_mile : named_scaled_unit<nautical_mile, "nmi", ratio(1852), si::metre> {};
|
||||
|
||||
// thou
|
||||
// https://en.wikipedia.org/wiki/Thousandth_of_an_inch
|
||||
struct thou : named_scaled_unit<thou, "thou", no_prefix, ratio(1, 1000), inch> {};
|
||||
struct thou : named_scaled_unit<thou, "thou", ratio(1, 1000), inch> {};
|
||||
|
||||
// mil - different name for thou
|
||||
// https://en.wikipedia.org/wiki/Thousandth_of_an_inch
|
||||
|
@ -37,7 +37,7 @@ namespace units::isq::si::international {
|
||||
struct mile_per_hour : derived_deduced_unit<mile_per_hour, si::dim_speed, si::international::mile, si::hour> {};
|
||||
struct nautical_mile_per_hour :
|
||||
derived_deduced_unit<nautical_mile_per_hour, si::dim_speed, si::international::nautical_mile, si::hour> {};
|
||||
struct knot : alias_unit<nautical_mile_per_hour, "kn", no_prefix> {};
|
||||
struct knot : alias_unit<nautical_mile_per_hour, "kn"> {};
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
|
@ -37,10 +37,10 @@ namespace units::isq::si::typographic {
|
||||
|
||||
// TODO Conflicts with (https://en.wikipedia.org/wiki/Pica_(typography)), verify correctness of below conversion factors
|
||||
// and provide hyperlinks to definitions
|
||||
struct pica_comp : named_scaled_unit<pica_comp, "pica(comp)", no_prefix, ratio(4233333, 1000000, -3), si::metre> {};
|
||||
struct pica_prn : named_scaled_unit<pica_prn, "pica(prn)", no_prefix, ratio(2108759, 500000, -3), si::metre> {};
|
||||
struct point_comp : named_scaled_unit<point_comp, "point(comp)", no_prefix, ratio(1763889, 500000, -4), si::metre> {};
|
||||
struct point_prn : named_scaled_unit<point_prn, "point(prn)", no_prefix, ratio(1757299, 500000, -4), si::metre> {};
|
||||
struct pica_comp : named_scaled_unit<pica_comp, "pica(comp)", ratio(4233333, 1000000, -3), si::metre> {};
|
||||
struct pica_prn : named_scaled_unit<pica_prn, "pica(prn)", ratio(2108759, 500000, -3), si::metre> {};
|
||||
struct point_comp : named_scaled_unit<point_comp, "point(comp)", ratio(1763889, 500000, -4), si::metre> {};
|
||||
struct point_prn : named_scaled_unit<point_prn, "point(prn)", ratio(1757299, 500000, -4), si::metre> {};
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
|
@ -36,14 +36,14 @@ namespace units::isq::si::uscs {
|
||||
|
||||
// https://en.wikipedia.org/wiki/Foot_(unit)#US_survey_foot
|
||||
// https://www.nist.gov/pml/special-publication-811/nist-guide-si-appendix-b-conversion-factors#B6
|
||||
struct foot : named_scaled_unit<foot, "ft(us)", no_prefix, ratio(1'200, 3'937), si::metre> {};
|
||||
struct foot : named_scaled_unit<foot, "ft(us)", ratio(1'200, 3'937), si::metre> {};
|
||||
|
||||
// https://www.nist.gov/pml/special-publication-811/nist-guide-si-appendix-b-conversion-factors#B6
|
||||
struct fathom : named_scaled_unit<fathom, "fathom(us)", no_prefix, ratio(6), foot> {};
|
||||
struct fathom : named_scaled_unit<fathom, "fathom(us)", ratio(6), foot> {};
|
||||
|
||||
// https://en.wikipedia.org/wiki/Mile#U.S._survey_mile
|
||||
// https://www.nist.gov/pml/special-publication-811/nist-guide-si-appendix-b-conversion-factors#B6
|
||||
struct mile : named_scaled_unit<mile, "mi(us)", no_prefix, ratio(5280), foot> {};
|
||||
struct mile : named_scaled_unit<mile, "mi(us)", ratio(5280), foot> {};
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct gray : named_unit<gray, "Gy", prefix> {};
|
||||
struct gray : named_unit<gray, "Gy"> {};
|
||||
struct yoctogray : prefixed_unit<yoctogray, yocto, gray> {};
|
||||
struct zeptogray : prefixed_unit<zeptogray, zepto, gray> {};
|
||||
struct attogray : prefixed_unit<attogray, atto, gray> {};
|
||||
|
@ -34,7 +34,7 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct mole : named_unit<mole, "mol", prefix> {};
|
||||
struct mole : named_unit<mole, "mol"> {};
|
||||
|
||||
struct dim_amount_of_substance : isq::dim_amount_of_substance<mole> {};
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct radian_per_second : named_unit<radian_per_second, basic_symbol_text{"ω", "w"}, prefix> {};
|
||||
struct radian_per_second : named_unit<radian_per_second, basic_symbol_text{"ω", "w"}> {};
|
||||
|
||||
struct dim_angular_velocity :
|
||||
isq::dim_angular_velocity<dim_angular_velocity, radian_per_second, dim_angle<>, dim_time> {};
|
||||
|
@ -58,7 +58,7 @@ struct square_exametre : derived_deduced_unit<square_exametre, dim_area, exametr
|
||||
struct square_zettametre : derived_deduced_unit<square_zettametre, dim_area, zettametre> {};
|
||||
struct square_yottametre : derived_deduced_unit<square_yottametre, dim_area, yottametre> {};
|
||||
|
||||
struct are : alias_unit<square_decametre, "a", prefix> {};
|
||||
struct are : alias_unit<square_decametre, "a"> {};
|
||||
struct centiare : prefixed_alias_unit<square_metre, centi, are> {};
|
||||
struct deciare : prefixed_unit<deciare, deci, are> {};
|
||||
struct decare : prefixed_unit<decare, deca, are> {};
|
||||
|
@ -36,7 +36,7 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct farad : named_unit<farad, "F", prefix> {};
|
||||
struct farad : named_unit<farad, "F"> {};
|
||||
struct yoctofarad : prefixed_unit<yoctofarad, yocto, farad> {};
|
||||
struct zeptofarad : prefixed_unit<zeptofarad, zepto, farad> {};
|
||||
struct attofarad : prefixed_unit<attofarad, atto, farad> {};
|
||||
|
@ -36,7 +36,7 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct katal : named_unit<katal, "kat", prefix> {};
|
||||
struct katal : named_unit<katal, "kat"> {};
|
||||
struct yoctokatal : prefixed_unit<yoctokatal, yocto, katal> {};
|
||||
struct zeptokatal : prefixed_unit<zeptokatal, zepto, katal> {};
|
||||
struct attokatal : prefixed_unit<attokatal, atto, katal> {};
|
||||
@ -58,7 +58,7 @@ struct exakatal : prefixed_unit<exakatal, exa, katal> {};
|
||||
struct zettakatal : prefixed_unit<zettakatal, zetta, katal> {};
|
||||
struct yottakatal : prefixed_unit<yottakatal, yotta, katal> {};
|
||||
|
||||
struct enzyme_unit : named_scaled_unit<enzyme_unit, "U", prefix, ratio(1, 60, -6), katal> {};
|
||||
struct enzyme_unit : named_scaled_unit<enzyme_unit, "U", ratio(1, 60, -6), katal> {};
|
||||
|
||||
struct dim_catalytic_activity :
|
||||
isq::dim_catalytic_activity<dim_catalytic_activity, katal, dim_time, dim_amount_of_substance> {};
|
||||
|
@ -35,7 +35,7 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct siemens : named_unit<siemens, "S", prefix> {};
|
||||
struct siemens : named_unit<siemens, "S"> {};
|
||||
struct yoctosiemens : prefixed_unit<yoctosiemens, yocto, siemens> {};
|
||||
struct zeptosiemens : prefixed_unit<zeptosiemens, zepto, siemens> {};
|
||||
struct attosiemens : prefixed_unit<attosiemens, atto, siemens> {};
|
||||
|
@ -35,7 +35,7 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct coulomb : named_unit<coulomb, "C", prefix> {};
|
||||
struct coulomb : named_unit<coulomb, "C"> {};
|
||||
|
||||
struct dim_electric_charge : isq::dim_electric_charge<dim_electric_charge, coulomb, dim_time, dim_electric_current> {};
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct ampere : named_unit<ampere, "A", prefix> {};
|
||||
struct ampere : named_unit<ampere, "A"> {};
|
||||
struct yoctoampere : prefixed_unit<yoctoampere, yocto, ampere> {};
|
||||
struct zeptoampere : prefixed_unit<zeptoampere, zepto, ampere> {};
|
||||
struct attoampere : prefixed_unit<attoampere, atto, ampere> {};
|
||||
|
@ -35,7 +35,7 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct joule : named_unit<joule, "J", prefix> {};
|
||||
struct joule : named_unit<joule, "J"> {};
|
||||
struct yoctojoule : prefixed_unit<yoctojoule, yocto, joule> {};
|
||||
struct zeptojoule : prefixed_unit<zeptojoule, zepto, joule> {};
|
||||
struct attojoule : prefixed_unit<attojoule, atto, joule> {};
|
||||
@ -55,7 +55,7 @@ struct yottajoule : prefixed_unit<yottajoule, yotta, joule> {};
|
||||
|
||||
// N.B. electron charge (and eV) is an exact constant:
|
||||
// https://www.bipm.org/documents/20126/41483022/SI-Brochure-9.pdf#page=147
|
||||
struct electronvolt : named_scaled_unit<electronvolt, "eV", prefix, ratio(1'602'176'634, 1'000'000'000, -19), joule> {};
|
||||
struct electronvolt : named_scaled_unit<electronvolt, "eV", ratio(1'602'176'634, 1'000'000'000, -19), joule> {};
|
||||
struct gigaelectronvolt : prefixed_unit<gigaelectronvolt, giga, electronvolt> {};
|
||||
|
||||
struct dim_energy : isq::dim_energy<dim_energy, joule, dim_force, dim_length> {};
|
||||
|
@ -36,7 +36,7 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct newton : named_unit<newton, "N", prefix> {};
|
||||
struct newton : named_unit<newton, "N"> {};
|
||||
struct yoctonewton : prefixed_unit<yoctonewton, yocto, newton> {};
|
||||
struct zeptonewton : prefixed_unit<zeptonewton, zepto, newton> {};
|
||||
struct attonewton : prefixed_unit<attonewton, atto, newton> {};
|
||||
|
@ -34,7 +34,7 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct hertz : named_unit<hertz, "Hz", prefix> {};
|
||||
struct hertz : named_unit<hertz, "Hz"> {};
|
||||
struct yoctohertz : prefixed_unit<yoctohertz, yocto, hertz> {};
|
||||
struct zeptohertz : prefixed_unit<zeptohertz, zepto, hertz> {};
|
||||
struct attohertz : prefixed_unit<attohertz, atto, hertz> {};
|
||||
|
@ -35,7 +35,7 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct henry : named_unit<henry, "H", prefix> {};
|
||||
struct henry : named_unit<henry, "H"> {};
|
||||
|
||||
struct yoctohenry : prefixed_unit<yoctohenry, yocto, henry> {};
|
||||
struct zeptohenry : prefixed_unit<zeptohenry, zepto, henry> {};
|
||||
|
@ -34,7 +34,7 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct metre : named_unit<metre, "m", prefix> {};
|
||||
struct metre : named_unit<metre, "m"> {};
|
||||
struct yoctometre : prefixed_unit<yoctometre, yocto, metre> {};
|
||||
struct zeptometre : prefixed_unit<zeptometre, zepto, metre> {};
|
||||
struct attometre : prefixed_unit<attometre, atto, metre> {};
|
||||
@ -56,7 +56,7 @@ struct exametre : prefixed_unit<exametre, exa, metre> {};
|
||||
struct zettametre : prefixed_unit<zettametre, zetta, metre> {};
|
||||
struct yottametre : prefixed_unit<yottametre, yotta, metre> {};
|
||||
|
||||
struct astronomical_unit : named_scaled_unit<astronomical_unit, "au", prefix, ratio(149'597'870'700), metre> {};
|
||||
struct astronomical_unit : named_scaled_unit<astronomical_unit, "au", ratio(149'597'870'700), metre> {};
|
||||
|
||||
struct dim_length : isq::dim_length<metre> {};
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct candela : named_unit<candela, "cd", prefix> {};
|
||||
struct candela : named_unit<candela, "cd"> {};
|
||||
struct yoctocandela : prefixed_unit<yoctocandela, yocto, candela> {};
|
||||
struct zeptocandela : prefixed_unit<zeptocandela, zepto, candela> {};
|
||||
struct attocandela : prefixed_unit<attocandela, atto, candela> {};
|
||||
|
@ -35,7 +35,7 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct weber : named_unit<weber, "Wb", prefix> {};
|
||||
struct weber : named_unit<weber, "Wb"> {};
|
||||
|
||||
struct yoctoweber : prefixed_unit<yoctoweber, yocto, weber> {};
|
||||
struct zeptoweber : prefixed_unit<zeptoweber, zepto, weber> {};
|
||||
|
@ -37,7 +37,7 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct tesla : named_unit<tesla, "T", prefix> {};
|
||||
struct tesla : named_unit<tesla, "T"> {};
|
||||
|
||||
struct yoctotesla : prefixed_unit<yoctotesla, yocto, tesla> {};
|
||||
struct zeptotesla : prefixed_unit<zeptotesla, zepto, tesla> {};
|
||||
@ -56,7 +56,7 @@ struct exatesla : prefixed_unit<exatesla, exa, tesla> {};
|
||||
struct zettatesla : prefixed_unit<zettatesla, zetta, tesla> {};
|
||||
struct yottatesla : prefixed_unit<yottatesla, yotta, tesla> {};
|
||||
|
||||
struct gauss : named_scaled_unit<gauss, "G", prefix, ratio(1, 10'000), tesla> {};
|
||||
struct gauss : named_scaled_unit<gauss, "G", ratio(1, 10'000), tesla> {};
|
||||
|
||||
struct dim_magnetic_induction :
|
||||
isq::dim_magnetic_induction<dim_magnetic_induction, tesla, dim_voltage, dim_time, dim_length> {};
|
||||
|
@ -34,7 +34,7 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct gram : named_unit<gram, "g", prefix> {};
|
||||
struct gram : named_unit<gram, "g"> {};
|
||||
struct yoctogram : prefixed_unit<yoctogram, yocto, gram> {};
|
||||
struct zeptogram : prefixed_unit<zeptogram, zepto, gram> {};
|
||||
struct attogram : prefixed_unit<attogram, atto, gram> {};
|
||||
@ -56,7 +56,7 @@ struct exagram : prefixed_unit<exagram, exa, gram> {};
|
||||
struct zettagram : prefixed_unit<zettagram, zetta, gram> {};
|
||||
struct yottagram : prefixed_unit<yottagram, yotta, gram> {};
|
||||
|
||||
struct tonne : alias_unit<megagram, "t", prefix> {};
|
||||
struct tonne : alias_unit<megagram, "t"> {};
|
||||
struct yoctotonne : prefixed_alias_unit<attogram, yocto, tonne> {};
|
||||
struct zeptotonne : prefixed_alias_unit<femtogram, zepto, tonne> {};
|
||||
struct attotonne : prefixed_alias_unit<picogram, atto, tonne> {};
|
||||
@ -78,8 +78,7 @@ struct exatonne : prefixed_alias_unit<yottagram, exa, tonne> {};
|
||||
struct zettatonne : prefixed_unit<zettatonne, zetta, tonne> {};
|
||||
struct yottatonne : prefixed_unit<yottatonne, yotta, tonne> {};
|
||||
|
||||
struct dalton :
|
||||
named_scaled_unit<dalton, "Da", prefix, ratio(16'605'390'666'050, 10'000'000'000'000, -27), kilogram> {};
|
||||
struct dalton : named_scaled_unit<dalton, "Da", ratio(16'605'390'666'050, 10'000'000'000'000, -27), kilogram> {};
|
||||
|
||||
struct dim_mass : isq::dim_mass<kilogram> {};
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct watt : named_unit<watt, "W", prefix> {};
|
||||
struct watt : named_unit<watt, "W"> {};
|
||||
struct yoctowatt : prefixed_unit<yoctowatt, yocto, watt> {};
|
||||
struct zeptowatt : prefixed_unit<zeptowatt, zepto, watt> {};
|
||||
struct attowatt : prefixed_unit<attowatt, atto, watt> {};
|
||||
|
@ -26,29 +26,27 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct prefix : prefix_family {};
|
||||
|
||||
// clang-format off
|
||||
struct yocto : units::prefix<yocto, prefix, "y", ratio(1, 1, -24)> {};
|
||||
struct zepto : units::prefix<zepto, prefix, "z", ratio(1, 1, -21)> {};
|
||||
struct atto : units::prefix<atto, prefix, "a", ratio(1, 1, -18)> {};
|
||||
struct femto : units::prefix<femto, prefix, "f", ratio(1, 1, -15)> {};
|
||||
struct pico : units::prefix<pico, prefix, "p", ratio(1, 1, -12)> {};
|
||||
struct nano : units::prefix<nano, prefix, "n", ratio(1, 1, -9)> {};
|
||||
struct micro : units::prefix<micro, prefix, basic_symbol_text{"\u00b5", "u"}, ratio(1, 1, -6)> {};
|
||||
struct milli : units::prefix<milli, prefix, "m", ratio(1, 1, -3)> {};
|
||||
struct centi : units::prefix<centi, prefix, "c", ratio(1, 1, -2)> {};
|
||||
struct deci : units::prefix<deci, prefix, "d", ratio(1, 1, -1)> {};
|
||||
struct deca : units::prefix<deca, prefix, "da", ratio(1, 1, 1)> {};
|
||||
struct hecto : units::prefix<hecto, prefix, "h", ratio(1, 1, 2)> {};
|
||||
struct kilo : units::prefix<kilo, prefix, "k", ratio(1, 1, 3)> {};
|
||||
struct mega : units::prefix<mega, prefix, "M", ratio(1, 1, 6)> {};
|
||||
struct giga : units::prefix<giga, prefix, "G", ratio(1, 1, 9)> {};
|
||||
struct tera : units::prefix<tera, prefix, "T", ratio(1, 1, 12)> {};
|
||||
struct peta : units::prefix<peta, prefix, "P", ratio(1, 1, 15)> {};
|
||||
struct exa : units::prefix<exa, prefix, "E", ratio(1, 1, 18)> {};
|
||||
struct zetta : units::prefix<zetta, prefix, "Z", ratio(1, 1, 21)> {};
|
||||
struct yotta : units::prefix<yotta, prefix, "Y", ratio(1, 1, 24)> {};
|
||||
struct yocto : units::prefix<yocto, "y", ratio(1, 1, -24)> {};
|
||||
struct zepto : units::prefix<zepto, "z", ratio(1, 1, -21)> {};
|
||||
struct atto : units::prefix<atto, "a", ratio(1, 1, -18)> {};
|
||||
struct femto : units::prefix<femto, "f", ratio(1, 1, -15)> {};
|
||||
struct pico : units::prefix<pico, "p", ratio(1, 1, -12)> {};
|
||||
struct nano : units::prefix<nano, "n", ratio(1, 1, -9)> {};
|
||||
struct micro : units::prefix<micro, basic_symbol_text{"\u00b5", "u"}, ratio(1, 1, -6)> {};
|
||||
struct milli : units::prefix<milli, "m", ratio(1, 1, -3)> {};
|
||||
struct centi : units::prefix<centi, "c", ratio(1, 1, -2)> {};
|
||||
struct deci : units::prefix<deci, "d", ratio(1, 1, -1)> {};
|
||||
struct deca : units::prefix<deca, "da", ratio(1, 1, 1)> {};
|
||||
struct hecto : units::prefix<hecto, "h", ratio(1, 1, 2)> {};
|
||||
struct kilo : units::prefix<kilo, "k", ratio(1, 1, 3)> {};
|
||||
struct mega : units::prefix<mega, "M", ratio(1, 1, 6)> {};
|
||||
struct giga : units::prefix<giga, "G", ratio(1, 1, 9)> {};
|
||||
struct tera : units::prefix<tera, "T", ratio(1, 1, 12)> {};
|
||||
struct peta : units::prefix<peta, "P", ratio(1, 1, 15)> {};
|
||||
struct exa : units::prefix<exa, "E", ratio(1, 1, 18)> {};
|
||||
struct zetta : units::prefix<zetta, "Z", ratio(1, 1, 21)> {};
|
||||
struct yotta : units::prefix<yotta, "Y", ratio(1, 1, 24)> {};
|
||||
// clang-format on
|
||||
|
||||
} // namespace units::isq::si
|
||||
|
@ -36,7 +36,7 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct pascal : named_unit<pascal, "Pa", prefix> {};
|
||||
struct pascal : named_unit<pascal, "Pa"> {};
|
||||
struct yoctopascal : prefixed_unit<yoctopascal, yocto, pascal> {};
|
||||
struct zeptopascal : prefixed_unit<zeptopascal, zepto, pascal> {};
|
||||
struct attopascal : prefixed_unit<attopascal, atto, pascal> {};
|
||||
|
@ -34,7 +34,7 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct becquerel : named_unit<becquerel, "Bq", prefix> {};
|
||||
struct becquerel : named_unit<becquerel, "Bq"> {};
|
||||
struct yoctobecquerel : prefixed_unit<yoctobecquerel, yocto, becquerel> {};
|
||||
struct zeptobecquerel : prefixed_unit<zeptobecquerel, zepto, becquerel> {};
|
||||
struct attobecquerel : prefixed_unit<attobecquerel, atto, becquerel> {};
|
||||
|
@ -36,7 +36,7 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct ohm : named_unit<ohm, basic_symbol_text{"Ω", "ohm"}, prefix> {};
|
||||
struct ohm : named_unit<ohm, basic_symbol_text{"Ω", "ohm"}> {};
|
||||
struct yoctoohm : prefixed_unit<yoctoohm, yocto, ohm> {};
|
||||
struct zeptoohm : prefixed_unit<zeptoohm, zepto, ohm> {};
|
||||
struct attoohm : prefixed_unit<attoohm, atto, ohm> {};
|
||||
|
@ -34,7 +34,7 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct kelvin : named_unit<kelvin, "K", prefix> {};
|
||||
struct kelvin : named_unit<kelvin, "K"> {};
|
||||
|
||||
struct dim_thermodynamic_temperature : isq::dim_thermodynamic_temperature<kelvin> {};
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct second : named_unit<second, "s", prefix> {};
|
||||
struct second : named_unit<second, "s"> {};
|
||||
struct yoctosecond : prefixed_unit<yoctosecond, yocto, second> {};
|
||||
struct zeptosecond : prefixed_unit<zeptosecond, zepto, second> {};
|
||||
struct attosecond : prefixed_unit<attosecond, atto, second> {};
|
||||
@ -43,9 +43,9 @@ struct picosecond : prefixed_unit<picosecond, pico, second> {};
|
||||
struct nanosecond : prefixed_unit<nanosecond, nano, second> {};
|
||||
struct microsecond : prefixed_unit<microsecond, micro, second> {};
|
||||
struct millisecond : prefixed_unit<millisecond, milli, second> {};
|
||||
struct minute : named_scaled_unit<minute, "min", no_prefix, ratio(60), second> {};
|
||||
struct hour : named_scaled_unit<hour, "h", no_prefix, ratio(60), minute> {};
|
||||
struct day : named_scaled_unit<day, "d", no_prefix, ratio(24), hour> {};
|
||||
struct minute : named_scaled_unit<minute, "min", ratio(60), second> {};
|
||||
struct hour : named_scaled_unit<hour, "h", ratio(60), minute> {};
|
||||
struct day : named_scaled_unit<day, "d", ratio(24), hour> {};
|
||||
|
||||
struct dim_time : isq::dim_time<second> {};
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
||||
|
||||
namespace units::isq::si {
|
||||
|
||||
struct volt : named_unit<volt, "V", prefix> {};
|
||||
struct volt : named_unit<volt, "V"> {};
|
||||
struct yoctovolt : prefixed_unit<yoctovolt, yocto, volt> {};
|
||||
struct zeptovolt : prefixed_unit<zeptovolt, zepto, volt> {};
|
||||
struct attovolt : prefixed_unit<attovolt, atto, volt> {};
|
||||
|
@ -58,7 +58,7 @@ struct cubic_exametre : derived_deduced_unit<cubic_exametre, dim_volume, exametr
|
||||
struct cubic_zettametre : derived_deduced_unit<cubic_zettametre, dim_volume, zettametre> {};
|
||||
struct cubic_yottametre : derived_deduced_unit<cubic_yottametre, dim_volume, yottametre> {};
|
||||
|
||||
struct litre : alias_unit<cubic_decimetre, "l", prefix> {};
|
||||
struct litre : alias_unit<cubic_decimetre, "l"> {};
|
||||
struct yoctolitre : prefixed_alias_unit<cubic_nanometre, yocto, litre> {};
|
||||
struct zeptolitre : prefixed_unit<zeptolitre, zepto, litre> {};
|
||||
struct attolitre : prefixed_unit<attolitre, atto, litre> {};
|
||||
|
@ -42,15 +42,9 @@ namespace {
|
||||
using namespace units;
|
||||
using namespace units::isq;
|
||||
|
||||
// Prefix family
|
||||
|
||||
static_assert(PrefixFamily<si::prefix>);
|
||||
static_assert(!PrefixFamily<si::kilo>);
|
||||
|
||||
// Prefix
|
||||
|
||||
static_assert(Prefix<si::kilo>);
|
||||
static_assert(!Prefix<si::prefix>);
|
||||
static_assert(!Prefix<std::kilo>);
|
||||
|
||||
// UnitRatio
|
||||
@ -92,6 +86,13 @@ static_assert(!Unit<si::dim_length>);
|
||||
static_assert(!Unit<int>);
|
||||
static_assert(!Unit<std::chrono::seconds>);
|
||||
|
||||
// NamedUnit
|
||||
|
||||
static_assert(NamedUnit<si::metre>);
|
||||
static_assert(NamedUnit<si::kilometre>);
|
||||
static_assert(NamedUnit<si::fps::mile>);
|
||||
static_assert(!NamedUnit<si::metre_per_second>);
|
||||
|
||||
// UnitOf
|
||||
|
||||
static_assert(UnitOf<si::metre, si::dim_length>);
|
||||
|
@ -30,13 +30,13 @@ using namespace units;
|
||||
|
||||
namespace {
|
||||
|
||||
struct u0 : named_unit<u0, "u0", no_prefix> {};
|
||||
struct u0 : named_unit<u0, "u0"> {};
|
||||
struct d0 : base_dimension<"d0", u0> {};
|
||||
struct u1 : named_unit<u1, "u1", no_prefix> {};
|
||||
struct u1 : named_unit<u1, "u1"> {};
|
||||
struct d1 : base_dimension<"d1", u1> {};
|
||||
struct u2 : named_unit<u2, "u2", no_prefix> {};
|
||||
struct u2 : named_unit<u2, "u2"> {};
|
||||
struct d2 : base_dimension<"d2", u2> {};
|
||||
struct u3 : named_unit<u3, "u3", no_prefix> {};
|
||||
struct u3 : named_unit<u3, "u3"> {};
|
||||
struct d3 : base_dimension<"d3", u3> {};
|
||||
|
||||
// exponent_invert
|
||||
|
@ -94,9 +94,9 @@ static_assert(
|
||||
is_same_v<type_list_split_half<type_list<int, long, double, float>>::second_list, type_list<double, float>>);
|
||||
|
||||
// type_list_merge_sorted
|
||||
struct u0 : named_unit<u0, "u0", no_prefix> {};
|
||||
struct u0 : named_unit<u0, "u0"> {};
|
||||
struct d0 : base_dimension<"d0", u0> {};
|
||||
struct u1 : named_unit<u1, "u1", no_prefix> {};
|
||||
struct u1 : named_unit<u1, "u1"> {};
|
||||
struct d1 : base_dimension<"d1", u1> {};
|
||||
|
||||
static_assert(
|
||||
|
@ -33,22 +33,22 @@ namespace {
|
||||
using namespace units;
|
||||
using namespace units::isq;
|
||||
|
||||
struct metre : named_unit<metre, "m", si::prefix> {};
|
||||
struct metre : named_unit<metre, "m"> {};
|
||||
struct centimetre : prefixed_unit<centimetre, si::centi, metre> {};
|
||||
struct kilometre : prefixed_unit<kilometre, si::kilo, metre> {};
|
||||
struct yard : named_scaled_unit<yard, "yd", no_prefix, ratio(9'144, 1, -4), metre> {};
|
||||
struct foot : named_scaled_unit<foot, "ft", no_prefix, ratio(1, 3), yard> {};
|
||||
struct yard : named_scaled_unit<yard, "yd", ratio(9'144, 1, -4), metre> {};
|
||||
struct foot : named_scaled_unit<foot, "ft", ratio(1, 3), yard> {};
|
||||
struct dim_length : base_dimension<"length", metre> {};
|
||||
|
||||
struct second : named_unit<second, "s", si::prefix> {};
|
||||
struct hour : named_scaled_unit<hour, "h", no_prefix, ratio(36, 1, 2), second> {};
|
||||
struct second : named_unit<second, "s"> {};
|
||||
struct hour : named_scaled_unit<hour, "h", ratio(36, 1, 2), second> {};
|
||||
struct dim_time : base_dimension<"time", second> {};
|
||||
|
||||
struct kelvin : named_unit<kelvin, "K", no_prefix> {};
|
||||
struct kelvin : named_unit<kelvin, "K"> {};
|
||||
|
||||
#if !UNITS_COMP_MSVC
|
||||
static_assert([]<Prefix P>(P) {
|
||||
return !requires { typename prefixed_unit<struct kilokelvin, P, kelvin>; };
|
||||
return !requires { typename prefixed_unit<struct kilokilometre, P, kilometre>; };
|
||||
}(si::kilo{})); // no prefix allowed
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user