refactor: 💥 Scalar concept renamed to ScalableNumber

Resolves #114
This commit is contained in:
Mateusz Pusz
2020-09-08 21:17:09 +02:00
parent 9ca65240c8
commit 9a49df7222
88 changed files with 149 additions and 148 deletions

View File

@ -11,7 +11,7 @@ Interface
The difference is that it uses ``double`` as a default representation and has The difference is that it uses ``double`` as a default representation and has
a few additional member types and functions:: a few additional member types and functions::
template<Dimension D, UnitOf<D> U, Scalar Rep = double> template<Dimension D, UnitOf<D> U, ScalableNumber Rep = double>
class quantity { class quantity {
public: public:
using dimension = D; using dimension = D;
@ -24,23 +24,23 @@ a few additional member types and functions::
template<typename D1, typename U1, typename Rep1, typename D2, typename U2, typename Rep2> template<typename D1, typename U1, typename Rep1, typename D2, typename U2, typename Rep2>
requires detail::basic_arithmetic<Rep1, Rep2> && equivalent_dim<D1, dim_invert<D2>> requires detail::basic_arithmetic<Rep1, Rep2> && equivalent_dim<D1, dim_invert<D2>>
[[nodiscard]] constexpr Scalar auto operator*(const quantity<D1, U1, Rep1>& lhs, [[nodiscard]] constexpr ScalableNumber auto operator*(const quantity<D1, U1, Rep1>& lhs,
const quantity<D2, U2, Rep2>& rhs); const quantity<D2, U2, Rep2>& rhs);
template<typename D1, typename U1, typename Rep1, typename D2, typename U2, typename Rep2> template<typename D1, typename U1, typename Rep1, typename D2, typename U2, typename Rep2>
requires detail::basic_arithmetic<Rep1, Rep2> && (!equivalent_dim<D1, dim_invert<D2>>) requires detail::basic_arithmetic<Rep1, Rep2> && (!equivalent_dim<D1, dim_invert<D2>>)
[[nodiscard]] constexpr Quantity auto operator*(const quantity<D1, U1, Rep1>& lhs, [[nodiscard]] constexpr Quantity auto operator*(const quantity<D1, U1, Rep1>& lhs,
const quantity<D2, U2, Rep2>& rhs); const quantity<D2, U2, Rep2>& rhs);
template<Scalar Value, typename D, typename U, typename Rep> template<ScalableNumber Value, typename D, typename U, typename Rep>
requires std::magma<std::ranges::divided_by, Value, Rep> requires std::magma<std::ranges::divided_by, Value, Rep>
[[nodiscard]] constexpr Quantity auto operator/(const Value& v, [[nodiscard]] constexpr Quantity auto operator/(const Value& v,
const quantity<D, U, Rep>& q); const quantity<D, U, Rep>& q);
template<typename D1, typename U1, typename Rep1, typename D2, typename U2, typename Rep2> template<typename D1, typename U1, typename Rep1, typename D2, typename U2, typename Rep2>
requires detail::basic_arithmetic<Rep1, Rep2> && equivalent_dim<D1, D2> requires detail::basic_arithmetic<Rep1, Rep2> && equivalent_dim<D1, D2>
[[nodiscard]] constexpr Scalar auto operator/(const quantity<D1, U1, Rep1>& lhs, [[nodiscard]] constexpr ScalableNumber auto operator/(const quantity<D1, U1, Rep1>& lhs,
const quantity<D2, U2, Rep2>& rhs); const quantity<D2, U2, Rep2>& rhs);
template<typename D1, typename U1, typename Rep1, typename D2, typename U2, typename Rep2> template<typename D1, typename U1, typename Rep1, typename D2, typename U2, typename Rep2>
requires detail::basic_arithmetic<Rep1, Rep2> && (!equivalent_dim<D1, D2>) requires detail::basic_arithmetic<Rep1, Rep2> && (!equivalent_dim<D1, D2>)

View File

@ -18,7 +18,7 @@ For example the speed of light constant in :term:`SI` is defined as::
namespace si::si2019 { namespace si::si2019 {
template<Scalar Rep = double> template<ScalableNumber Rep = double>
inline constexpr auto speed_of_light = speed<metre_per_second, Rep>(299792458); inline constexpr auto speed_of_light = speed<metre_per_second, Rep>(299792458);
} }
@ -27,7 +27,7 @@ The same constant defined for natural units may be provided as::
namespace natural { namespace natural {
template<Scalar Rep = double> template<ScalableNumber Rep = double>
inline constexpr auto speed_of_light = speed<unitless, Rep>(1); inline constexpr auto speed_of_light = speed<unitless, Rep>(1);
} }

View File

@ -23,7 +23,7 @@ each other and the result will always be a quantity of the same dimension:
Length auto res2 = dist1 - dist2; Length auto res2 = dist1 - dist2;
Additionally, we can always multiply or divide a quantity by a Additionally, we can always multiply or divide a quantity by a
:term:`scalar` and in such a case the quantity's dimension will also :term:`scalable number` and in such a case the quantity's dimension will also
not change: not change:
.. code-block:: .. code-block::
@ -35,7 +35,7 @@ not change:
Length auto res3 = res2 / 2; // 6 m Length auto res3 = res2 / 2; // 6 m
However, if we try to multiply or divide quantities of the same or However, if we try to multiply or divide quantities of the same or
different dimensions, or we will divide a scalar by a quantity, we most different dimensions, or we will divide a scalable number by a quantity, we most
probably will always end up in a quantity of a yet another dimension: probably will always end up in a quantity of a yet another dimension:
.. code-block:: .. code-block::
@ -50,7 +50,7 @@ probably will always end up in a quantity of a yet another dimension:
However, please note that there is an exception from the above rule. However, please note that there is an exception from the above rule.
In case we divide the same dimensions, or multiply by the inverted In case we divide the same dimensions, or multiply by the inverted
dimension, than we will end up with just a scalar type: dimension, than we will end up with just a scalable number type:
.. code-block:: .. code-block::
:emphasize-lines: 4-5 :emphasize-lines: 4-5
@ -58,8 +58,8 @@ dimension, than we will end up with just a scalar type:
Time auto dur1 = 10q_s; Time auto dur1 = 10q_s;
Time auto dur2 = 2q_s; Time auto dur2 = 2q_s;
Frequency auto fr1 = 5q_Hz; Frequency auto fr1 = 5q_Hz;
Scalar auto v1 = dur1 / dur2; // 5 ScalableNumber auto v1 = dur1 / dur2; // 5
Scalar auto v2 = dur1 * fr1; // 50 ScalableNumber auto v2 = dur1 * fr1; // 50
Quantity points have a more restricted set of operations. Quantity points have a more restricted set of operations.
Quantity points can't be added together, Quantity points can't be added together,

View File

@ -11,7 +11,7 @@ with a specific representation and is represented in the library with a
Quantity Construction Quantity Construction
--------------------- ---------------------
To create the quantity object from a :term:`scalar` we just have to pass To create the quantity object from a :term:`scalable number` we just have to pass
the value to the `quantity` class template explicit constructor:: the value to the `quantity` class template explicit constructor::
quantity<si::dim_length, si::kilometre, double> d(123); quantity<si::dim_length, si::kilometre, double> d(123);
@ -33,7 +33,7 @@ type to ``double`` by default::
namespace si { namespace si {
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using length = quantity<dim_length, U, Rep>; using length = quantity<dim_length, U, Rep>;
} }
@ -73,7 +73,8 @@ be used::
All instances of `quantity` class always match the `Quantity` concept. All instances of `quantity` class always match the `Quantity` concept.
All other regular types that are not quantities are called All other regular types that are not quantities are called
:term:`scalars <scalar>` by the library and match the `Scalar` concept. :term:`scalable numbers <scalable number>` by the library and match the
`ScalableNumber` concept.
However, the above is not the most important usage of those concepts. Let's However, the above is not the most important usage of those concepts. Let's
assume that the user wants to implement an ``avg_speed`` function that will assume that the user wants to implement an ``avg_speed`` function that will
@ -183,7 +184,7 @@ are provided::
template<typename T> template<typename T>
concept Dimensionless = QuantityOf<T, dim_one>; concept Dimensionless = QuantityOf<T, dim_one>;
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using dimensionless = quantity<dim_one, U, Rep>; using dimensionless = quantity<dim_one, U, Rep>;
There are two special units provided for usage with such a quantity: There are two special units provided for usage with such a quantity:

View File

@ -198,7 +198,7 @@ Other definitions
- The order and types of dimensions used in the recipe determine how an unnamed - The order and types of dimensions used in the recipe determine how an unnamed
dimension's unit symbol is being printed in the text output dimension's unit symbol is being printed in the text output
scalar scalable number
- Not a `quantity` - Not a `quantity`
- Can be passed as a representation type to the :class:`units::quantity` type or be used as a factor - Can be passed as a representation type to the :class:`units::quantity` type or be used as a factor
while multiplying or dividing a `quantity`. while multiplying or dividing a `quantity`.

View File

@ -9,11 +9,11 @@ its own custom logic for it (i.e. use a complex number or a measurement class th
not only a value but also a measurement error). not only a value but also a measurement error).
A `Scalar` concept A `ScalableNumber` concept
------------------ --------------------------
To support a minimum set of `quantity` operations all custom representation types have to To support a minimum set of `quantity` operations all custom representation types have to
satisfy at least the `Scalar` concept. Which means that they: satisfy at least the `ScalableNumber` concept. Which means that they:
- cannot be quantities by themselves, - cannot be quantities by themselves,
- cannot be wrappers over the `quantity` type (i.e. ``std::optional<si::length<si::metre>>``), - cannot be wrappers over the `quantity` type (i.e. ``std::optional<si::length<si::metre>>``),
@ -101,8 +101,8 @@ The only difference here is that in this case we have to explicitly cast the `qu
Additional Requirements Additional Requirements
----------------------- -----------------------
As noted in the previous chapter, the `Scalar` concept guarantees us the possibility to As noted in the previous chapter, the `ScalableNumber` concept guarantees us the possibility
construct quantities, convert between the units of the same dimension, and compare them to construct quantities, convert between the units of the same dimension, and compare them
for equality. To provide additional `quantity` operations the custom representation type for equality. To provide additional `quantity` operations the custom representation type
have to satisfy more requirements. have to satisfy more requirements.
@ -200,7 +200,7 @@ The `quantity` class template has a few static member functions: `quantity::zero
representation type. The default implementation is provided through the `quantity_values` class representation type. The default implementation is provided through the `quantity_values` class
template:: template::
template<Scalar Rep> template<ScalableNumber Rep>
struct quantity_values { struct quantity_values {
static constexpr Rep zero() noexcept { return Rep(0); } static constexpr Rep zero() noexcept { return Rep(0); }
static constexpr Rep one() noexcept { return Rep(1); } static constexpr Rep one() noexcept { return Rep(1); }
@ -220,7 +220,7 @@ library's framework treat floating-point representation types differently than t
ones. This behavior can also be extended to the custom representation types with ones. This behavior can also be extended to the custom representation types with
`treat_as_floating_point` customization point which default definition is:: `treat_as_floating_point` customization point which default definition is::
template<Scalar Rep> template<ScalableNumber Rep>
inline constexpr bool treat_as_floating_point = std::is_floating_point_v<Rep>; inline constexpr bool treat_as_floating_point = std::is_floating_point_v<Rep>;
If our representation type should have a floating-point semantics or if it is a class If our representation type should have a floating-point semantics or if it is a class

View File

@ -121,7 +121,7 @@ coherent unit::
struct desk_per_hour : deduced_unit<desk_per_hour, dim_desk_rate, desk, si::hour> {}; struct desk_per_hour : deduced_unit<desk_per_hour, dim_desk_rate, desk, si::hour> {};
// a quantity of our dimension // a quantity of our dimension
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using desk_rate = quantity<dim_desk_rate, U, Rep>; using desk_rate = quantity<dim_desk_rate, U, Rep>;
// a concept matching the above quantity // a concept matching the above quantity
@ -150,7 +150,7 @@ define a new base dimension, its units, quantity helper, concept, and UDLs::
struct person : named_unit<person, "person", no_prefix> {}; struct person : named_unit<person, "person", no_prefix> {};
struct dim_people : base_dimension<"people", person> {}; struct dim_people : base_dimension<"people", person> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using people = quantity<dim_people, U, Rep>; using people = quantity<dim_people, U, Rep>;
template<typename T> template<typename T>
@ -169,7 +169,7 @@ With the above we can now define a new derived dimension::
struct person_per_desk : deduced_unit<person_per_desk, dim_occupancy_rate, person, desk> {}; struct person_per_desk : deduced_unit<person_per_desk, dim_occupancy_rate, person, desk> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using occupancy_rate = quantity<dim_occupancy_rate, U, Rep>; using occupancy_rate = quantity<dim_occupancy_rate, U, Rep>;
template<typename T> template<typename T>

View File

@ -63,7 +63,7 @@ Concepts
satisfy :expr:`Quantity<typename T::value_type>` recursively satisfy :expr:`Quantity<typename T::value_type>` recursively
(i.e. :expr:`std::optional<si::length<si::metre>>`). (i.e. :expr:`std::optional<si::length<si::metre>>`).
.. concept:: template<typename T> Scalar .. concept:: template<typename T> ScalableNumber
A concept matching non-Quantity types. Satisfied by types that match A concept matching non-Quantity types. Satisfied by types that match
:expr:`(!Quantity<T>) && (!WrappedQuantity<T>) && std::regular<T>` and satisfy one of the :expr:`(!Quantity<T>) && (!WrappedQuantity<T>) && std::regular<T>` and satisfy one of the

View File

@ -87,7 +87,7 @@ public:
} }
template<typename V> template<typename V>
requires (Scalar<V> || Dimensionless<V>) requires (ScalableNumber<V> || Dimensionless<V>)
[[nodiscard]] friend constexpr auto operator*(const vector& lhs, const V& value) [[nodiscard]] friend constexpr auto operator*(const vector& lhs, const V& value)
requires requires { lhs.magnitude() * value; } requires requires { lhs.magnitude() * value; }
{ {
@ -95,7 +95,7 @@ public:
} }
template<typename V> template<typename V>
requires (Scalar<V> || Dimensionless<V>) requires (ScalableNumber<V> || Dimensionless<V>)
[[nodiscard]] friend constexpr auto operator*(const V& value, const vector& rhs) [[nodiscard]] friend constexpr auto operator*(const V& value, const vector& rhs)
requires requires { value * rhs.magnitude(); } requires requires { value * rhs.magnitude(); }
{ {

View File

@ -200,10 +200,10 @@ void matrix_of_quantity_tests()
matrix_of_quantity_divide_by_scalar(); matrix_of_quantity_divide_by_scalar();
} }
template<units::Unit U = si::metre, units::Scalar Rep = double> template<units::Unit U = si::metre, units::ScalableNumber Rep = double>
using length_v = si::length<U, vector<Rep>>; using length_v = si::length<U, vector<Rep>>;
template<units::Unit U = si::newton, units::Scalar Rep = double> template<units::Unit U = si::newton, units::ScalableNumber Rep = double>
using force_v = si::force<U, vector<Rep>>; using force_v = si::force<U, vector<Rep>>;
void quantity_of_vector_add() void quantity_of_vector_add()
@ -273,7 +273,7 @@ void quantity_of_vector_tests()
quantity_of_vector_divide_by_scalar(); quantity_of_vector_divide_by_scalar();
} }
template<units::Unit U = si::metre, units::Scalar Rep = double> template<units::Unit U = si::metre, units::ScalableNumber Rep = double>
using length_m = si::length<U, matrix<Rep>>; using length_m = si::length<U, matrix<Rep>>;
void quantity_of_matrix_add() void quantity_of_matrix_add()

View File

@ -114,7 +114,7 @@ private:
value_type uncertainty_{}; value_type uncertainty_{};
}; };
static_assert(units::Scalar<measurement<double>>); static_assert(units::ScalableNumber<measurement<double>>);
} // namespace } // namespace

View File

@ -26,10 +26,10 @@
namespace units { namespace units {
template<Dimension D, UnitOf<D> U, Scalar Rep> template<Dimension D, UnitOf<D> U, ScalableNumber Rep>
class quantity; class quantity;
template<Dimension D, UnitOf<D> U, Scalar Rep> template<Dimension D, UnitOf<D> U, ScalableNumber Rep>
class quantity_point; class quantity_point;
namespace detail { namespace detail {
@ -65,7 +65,7 @@ quantity_point<D, U, Rep> common_quantity_point_impl(quantity<D, U, Rep>);
} // namespace detail } // namespace detail
template<Quantity Q1, Quantity Q2, Scalar Rep = std::common_type_t<typename Q1::rep, typename Q2::rep>> template<Quantity Q1, Quantity Q2, ScalableNumber Rep = std::common_type_t<typename Q1::rep, typename Q2::rep>>
requires equivalent_dim<typename Q1::dimension, typename Q2::dimension> requires equivalent_dim<typename Q1::dimension, typename Q2::dimension>
using common_quantity = TYPENAME detail::common_quantity_impl<Q1, Q2, Rep>::type; using common_quantity = TYPENAME detail::common_quantity_impl<Q1, Q2, Rep>::type;

View File

@ -250,7 +250,7 @@ inline constexpr bool is_wrapped_quantity<T> = Quantity<typename T::value_type>
template<typename T> template<typename T>
concept WrappedQuantity = detail::is_wrapped_quantity<T>; concept WrappedQuantity = detail::is_wrapped_quantity<T>;
// Scalar // ScalableNumber
namespace detail { namespace detail {
@ -280,7 +280,7 @@ concept not_constructible_from_integral =
* Satisfied by types that satisfy `(!Quantity<T>) && (!WrappedQuantity<T>) && std::regular<T>`. * Satisfied by types that satisfy `(!Quantity<T>) && (!WrappedQuantity<T>) && std::regular<T>`.
*/ */
template<typename T> template<typename T>
concept Scalar = concept ScalableNumber =
(!Quantity<T>) && (!Quantity<T>) &&
(!WrappedQuantity<T>) && (!WrappedQuantity<T>) &&
std::regular<T> && std::regular<T> &&

View File

@ -37,7 +37,7 @@ namespace units {
* *
* @tparam Rep a representation type for which a type trait is defined * @tparam Rep a representation type for which a type trait is defined
*/ */
template<Scalar Rep> template<ScalableNumber Rep>
inline constexpr bool treat_as_floating_point = std::is_floating_point_v<Rep>; inline constexpr bool treat_as_floating_point = std::is_floating_point_v<Rep>;
/** /**
@ -49,7 +49,7 @@ inline constexpr bool treat_as_floating_point = std::is_floating_point_v<Rep>;
* *
* @tparam Rep a representation type for which a type trait is defined * @tparam Rep a representation type for which a type trait is defined
*/ */
template<Scalar Rep> template<ScalableNumber Rep>
struct quantity_values { struct quantity_values {
static constexpr Rep zero() noexcept { return Rep(0); } static constexpr Rep zero() noexcept { return Rep(0); }
static constexpr Rep one() noexcept { return Rep(1); } static constexpr Rep one() noexcept { return Rep(1); }

View File

@ -41,7 +41,7 @@ struct pebibit_per_second : deduced_unit<pebibit_per_second, dim_bitrate, pebibi
template<typename T> template<typename T>
concept Bitrate = QuantityOf<T, dim_bitrate>; concept Bitrate = QuantityOf<T, dim_bitrate>;
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using bitrate = quantity<dim_bitrate, U, Rep>; using bitrate = quantity<dim_bitrate, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -48,7 +48,7 @@ struct dim_information : base_dimension<"information", bit> {};
template<typename T> template<typename T>
concept Information = QuantityOf<T, dim_information>; concept Information = QuantityOf<T, dim_information>;
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using information = quantity<dim_information, U, Rep>; using information = quantity<dim_information, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -40,7 +40,7 @@ struct dim_one : derived_dimension<dim_one, unitless> {};
template<typename T> template<typename T>
concept Dimensionless = QuantityOf<T, dim_one>; concept Dimensionless = QuantityOf<T, dim_one>;
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using dimensionless = quantity<dim_one, U, Rep>; using dimensionless = quantity<dim_one, U, Rep>;
} // namespace units } // namespace units

View File

@ -31,7 +31,7 @@ namespace units::physical::cgs {
struct gal : named_unit<gal, "Gal", si::prefix> {}; struct gal : named_unit<gal, "Gal", si::prefix> {};
struct dim_acceleration : physical::dim_acceleration<dim_acceleration, gal, dim_length, dim_time> {}; struct dim_acceleration : physical::dim_acceleration<dim_acceleration, gal, dim_length, dim_time> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using acceleration = quantity<dim_acceleration, U, Rep>; using acceleration = quantity<dim_acceleration, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -33,7 +33,7 @@ using si::square_centimetre;
struct dim_area : physical::dim_area<dim_area, square_centimetre, dim_length> {}; struct dim_area : physical::dim_area<dim_area, square_centimetre, dim_length> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using area = quantity<dim_area, U, Rep>; using area = quantity<dim_area, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -33,7 +33,7 @@ struct erg : named_unit<erg, "erg", si::prefix> {};
struct dim_energy : physical::dim_energy<dim_energy, erg, dim_force, dim_length> {}; struct dim_energy : physical::dim_energy<dim_energy, erg, dim_force, dim_length> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using energy = quantity<dim_energy, U, Rep>; using energy = quantity<dim_energy, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -34,7 +34,7 @@ struct dyne : named_unit<dyne, "dyn", si::prefix> {};
struct dim_force : physical::dim_force<dim_force, dyne, dim_mass, dim_acceleration> {}; struct dim_force : physical::dim_force<dim_force, dyne, dim_mass, dim_acceleration> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using force = quantity<dim_force, U, Rep>; using force = quantity<dim_force, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -32,7 +32,7 @@ using si::centimetre;
struct dim_length : physical::dim_length<centimetre> {}; struct dim_length : physical::dim_length<centimetre> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using length = quantity<dim_length, U, Rep>; using length = quantity<dim_length, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -32,7 +32,7 @@ using si::gram;
struct dim_mass : physical::dim_mass<gram> {}; struct dim_mass : physical::dim_mass<gram> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using mass = quantity<dim_mass, U, Rep>; using mass = quantity<dim_mass, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -33,7 +33,7 @@ struct erg_per_second : unit<erg_per_second> {};
struct dim_power : physical::dim_power<dim_power, erg_per_second, dim_energy, dim_time> {}; struct dim_power : physical::dim_power<dim_power, erg_per_second, dim_energy, dim_time> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using power = quantity<dim_power, U, Rep>; using power = quantity<dim_power, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -34,7 +34,7 @@ struct barye : named_unit<barye, "Ba", si::prefix> {};
struct dim_pressure : physical::dim_pressure<dim_pressure, barye, dim_force, dim_area> {}; struct dim_pressure : physical::dim_pressure<dim_pressure, barye, dim_force, dim_area> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using pressure = quantity<dim_pressure, U, Rep>; using pressure = quantity<dim_pressure, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -32,7 +32,7 @@ namespace units::physical::cgs {
struct centimetre_per_second : unit<centimetre_per_second> {}; struct centimetre_per_second : unit<centimetre_per_second> {};
struct dim_speed : physical::dim_speed<dim_speed, centimetre_per_second, dim_length, dim_time> {}; struct dim_speed : physical::dim_speed<dim_speed, centimetre_per_second, dim_length, dim_time> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using speed = quantity<dim_speed, U, Rep>; using speed = quantity<dim_speed, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -31,7 +31,7 @@ namespace units::physical::fps {
struct foot_per_second_sq : unit<foot_per_second_sq> {}; struct foot_per_second_sq : unit<foot_per_second_sq> {};
struct dim_acceleration : physical::dim_acceleration<dim_acceleration, foot_per_second_sq, dim_length, dim_time> {}; struct dim_acceleration : physical::dim_acceleration<dim_acceleration, foot_per_second_sq, dim_length, dim_time> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using acceleration = quantity<dim_acceleration, U, Rep>; using acceleration = quantity<dim_acceleration, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -33,7 +33,7 @@ struct square_foot : unit<square_foot> {};
struct dim_area : physical::dim_area<dim_area, square_foot, dim_length> {}; struct dim_area : physical::dim_area<dim_area, square_foot, dim_length> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using area = quantity<dim_area, U, Rep>; using area = quantity<dim_area, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -33,7 +33,7 @@ struct pound_per_foot_cub : unit<pound_per_foot_cub> {};
struct dim_density : physical::dim_density<dim_density, pound_per_foot_cub, dim_mass, dim_length> {}; struct dim_density : physical::dim_density<dim_density, pound_per_foot_cub, dim_mass, dim_length> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using density = quantity<dim_density, U, Rep>; using density = quantity<dim_density, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -39,7 +39,7 @@ struct foot_pound_force : noble_deduced_unit<foot_pound_force, dim_energy, pound
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using energy = quantity<dim_energy, U, Rep>; using energy = quantity<dim_energy, U, Rep>;

View File

@ -43,7 +43,7 @@ struct kip : alias_unit<kilopound_force, "klbf", no_prefix> {};
struct dim_force : physical::dim_force<dim_force, poundal, dim_mass, dim_acceleration> {}; struct dim_force : physical::dim_force<dim_force, poundal, dim_mass, dim_acceleration> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using force = quantity<dim_force, U, Rep>; using force = quantity<dim_force, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -52,7 +52,7 @@ struct nautical_mile : named_scaled_unit<nautical_mile, "mi(naut)", no_prefix, r
struct dim_length : physical::dim_length<foot> {}; struct dim_length : physical::dim_length<foot> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using length = quantity<dim_length, U, Rep>; using length = quantity<dim_length, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -33,7 +33,7 @@ struct pound : named_scaled_unit<pound, "lb", no_prefix, ratio(45'359'237, 100'0
struct dim_mass : physical::dim_mass<pound> {}; struct dim_mass : physical::dim_mass<pound> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using mass = quantity<dim_mass, U, Rep>; 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", no_prefix, ratio(1, 7000), pound>{};

View File

@ -37,7 +37,7 @@ struct foot_pound_force_per_second : deduced_unit<foot_pound_force_per_second, d
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", no_prefix, ratio(550), foot_pound_force_per_second> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using power = quantity<dim_power, U, Rep>; using power = quantity<dim_power, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -34,7 +34,7 @@ struct poundal_per_foot_sq : unit<poundal_per_foot_sq> {};
struct dim_pressure : physical::dim_pressure<dim_pressure, poundal_per_foot_sq, dim_force, dim_area> {}; struct dim_pressure : physical::dim_pressure<dim_pressure, poundal_per_foot_sq, dim_force, dim_area> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using pressure = quantity<dim_pressure, U, Rep>; 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> {}; 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> {};

View File

@ -32,7 +32,7 @@ namespace units::physical::fps {
struct foot_per_second : unit<foot_per_second> {}; struct foot_per_second : unit<foot_per_second> {};
struct dim_speed : physical::dim_speed<dim_speed, foot_per_second, dim_length, dim_time> {}; struct dim_speed : physical::dim_speed<dim_speed, foot_per_second, dim_length, dim_time> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using speed = quantity<dim_speed, U, Rep>; using speed = quantity<dim_speed, U, Rep>;
struct mile_per_hour : deduced_unit<mile_per_hour, dim_speed, mile, hour>{}; struct mile_per_hour : deduced_unit<mile_per_hour, dim_speed, mile, hour>{};

View File

@ -33,7 +33,7 @@ struct dim_volume : physical::dim_volume<dim_volume, cubic_foot, dim_length> {};
struct cubic_yard : deduced_unit<cubic_yard, dim_volume, yard> {}; struct cubic_yard : deduced_unit<cubic_yard, dim_volume, yard> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using volume = quantity<dim_volume, U, Rep>; using volume = quantity<dim_volume, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -26,7 +26,7 @@
namespace units::physical::natural { namespace units::physical::natural {
template<Scalar Rep = double> template<ScalableNumber Rep = double>
inline constexpr auto speed_of_light = speed<unitless, Rep>(1); inline constexpr auto speed_of_light = speed<unitless, Rep>(1);
} // namespace units::physical::natural } // namespace units::physical::natural

View File

@ -29,35 +29,35 @@
namespace units::physical::natural { namespace units::physical::natural {
struct dim_length : physical::dim_length<inverted_gigaelectronvolt> {}; struct dim_length : physical::dim_length<inverted_gigaelectronvolt> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using length = quantity<dim_length, U, Rep>; using length = quantity<dim_length, U, Rep>;
struct dim_time : physical::dim_time<inverted_gigaelectronvolt> {}; struct dim_time : physical::dim_time<inverted_gigaelectronvolt> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using time = quantity<dim_time, U, Rep>; using time = quantity<dim_time, U, Rep>;
struct dim_mass : physical::dim_mass<gigaelectronvolt> {}; struct dim_mass : physical::dim_mass<gigaelectronvolt> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using mass = quantity<dim_mass, U, Rep>; using mass = quantity<dim_mass, U, Rep>;
struct dim_speed : physical::dim_speed<dim_speed, unitless, dim_length, dim_time> {}; struct dim_speed : physical::dim_speed<dim_speed, unitless, dim_length, dim_time> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using speed = quantity<dim_speed, U, Rep>; using speed = quantity<dim_speed, U, Rep>;
struct dim_acceleration : physical::dim_acceleration<dim_acceleration, gigaelectronvolt, dim_length, dim_time> {}; struct dim_acceleration : physical::dim_acceleration<dim_acceleration, gigaelectronvolt, dim_length, dim_time> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using acceleration = quantity<dim_acceleration, U, Rep>; using acceleration = quantity<dim_acceleration, U, Rep>;
struct dim_force : physical::dim_force<dim_force, square_gigaelectronvolt, dim_mass, dim_acceleration> {}; struct dim_force : physical::dim_force<dim_force, square_gigaelectronvolt, dim_mass, dim_acceleration> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using force = quantity<dim_force, U, Rep>; using force = quantity<dim_force, U, Rep>;
struct dim_momentum : physical::dim_momentum<dim_momentum, gigaelectronvolt, dim_mass, dim_speed> {}; struct dim_momentum : physical::dim_momentum<dim_momentum, gigaelectronvolt, dim_mass, dim_speed> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using momentum = quantity<dim_momentum, U, Rep>; using momentum = quantity<dim_momentum, U, Rep>;
struct dim_energy : physical::dim_energy<dim_energy, gigaelectronvolt, dim_force, dim_length> {}; struct dim_energy : physical::dim_energy<dim_energy, gigaelectronvolt, dim_force, dim_length> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using energy = quantity<dim_force, U, Rep>; using energy = quantity<dim_force, U, Rep>;
// Typical UDLs will not work here as the same units are reused by many quantities. // Typical UDLs will not work here as the same units are reused by many quantities.

View File

@ -54,7 +54,7 @@ struct yottagray : prefixed_unit<yottagray, yotta, gray> {};
struct dim_absorbed_dose : physical::dim_absorbed_dose<dim_absorbed_dose, gray, dim_energy, dim_mass> {}; struct dim_absorbed_dose : physical::dim_absorbed_dose<dim_absorbed_dose, gray, dim_energy, dim_mass> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using absorbed_dose = quantity<dim_absorbed_dose, U, Rep>; using absorbed_dose = quantity<dim_absorbed_dose, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -31,7 +31,7 @@ namespace units::physical::si {
struct metre_per_second_sq : unit<metre_per_second_sq> {}; struct metre_per_second_sq : unit<metre_per_second_sq> {};
struct dim_acceleration : physical::dim_acceleration<dim_acceleration, metre_per_second_sq, dim_length, dim_time> {}; struct dim_acceleration : physical::dim_acceleration<dim_acceleration, metre_per_second_sq, dim_length, dim_time> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using acceleration = quantity<dim_acceleration, U, Rep>; using acceleration = quantity<dim_acceleration, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -32,7 +32,7 @@ struct radian : named_unit<radian, "rad", prefix> {};
struct dim_angle : physical::dim_angle<radian> {}; struct dim_angle : physical::dim_angle<radian> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using angle = quantity<dim_angle, U, Rep>; using angle = quantity<dim_angle, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -34,7 +34,7 @@ struct radian_per_second : named_unit<radian_per_second, basic_symbol_text{"ω",
struct dim_angular_velocity : physical::dim_angular_velocity<dim_angular_velocity, radian_per_second, dim_angle, dim_time> {}; struct dim_angular_velocity : physical::dim_angular_velocity<dim_angular_velocity, radian_per_second, dim_angle, dim_time> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using angular_velocity = quantity<dim_angular_velocity, U, Rep>; using angular_velocity = quantity<dim_angular_velocity, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -54,7 +54,7 @@ struct square_yottametre : deduced_unit<square_yottametre, dim_area, yottametre>
struct hectare : alias_unit<square_hectometre, "ha", no_prefix> {}; struct hectare : alias_unit<square_hectometre, "ha", no_prefix> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using area = quantity<dim_area, U, Rep>; using area = quantity<dim_area, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -54,7 +54,7 @@ struct yottafarad : prefixed_unit<yottafarad, yotta, farad> {};
struct dim_capacitance : physical::dim_capacitance<dim_capacitance, farad, dim_electric_charge, dim_voltage> {}; struct dim_capacitance : physical::dim_capacitance<dim_capacitance, farad, dim_electric_charge, dim_voltage> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using capacitance = quantity<dim_capacitance, U, Rep>; using capacitance = quantity<dim_capacitance, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -56,7 +56,7 @@ struct enzyme_unit : named_scaled_unit<enzyme_unit, "U", prefix, ratio(1, 60, -6
struct dim_catalytic_activity : physical::dim_catalytic_activity<dim_catalytic_activity, katal, dim_time, dim_substance> {}; struct dim_catalytic_activity : physical::dim_catalytic_activity<dim_catalytic_activity, katal, dim_time, dim_substance> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using catalytic_activity = quantity<dim_catalytic_activity, U, Rep>; using catalytic_activity = quantity<dim_catalytic_activity, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -36,10 +36,10 @@ struct coulomb_per_metre_sq : unit<coulomb_per_metre_sq> {};
struct dim_charge_density : physical::dim_charge_density<dim_charge_density, coulomb_per_metre_cub, dim_electric_charge, dim_length> {}; struct dim_charge_density : physical::dim_charge_density<dim_charge_density, coulomb_per_metre_cub, dim_electric_charge, dim_length> {};
struct dim_surface_charge_density : physical::dim_surface_charge_density<dim_surface_charge_density, coulomb_per_metre_sq, dim_electric_charge, dim_length> {}; struct dim_surface_charge_density : physical::dim_surface_charge_density<dim_surface_charge_density, coulomb_per_metre_sq, dim_electric_charge, dim_length> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using charge_density = quantity<dim_charge_density, U, Rep>; using charge_density = quantity<dim_charge_density, U, Rep>;
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using surface_charge_density = quantity<dim_surface_charge_density, U, Rep>; using surface_charge_density = quantity<dim_surface_charge_density, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -32,7 +32,7 @@ namespace units::physical::si {
struct mol_per_metre_cub : unit<mol_per_metre_cub> {}; struct mol_per_metre_cub : unit<mol_per_metre_cub> {};
struct dim_concentration : physical::dim_concentration<dim_concentration, mol_per_metre_cub, dim_substance, dim_length> {}; struct dim_concentration : physical::dim_concentration<dim_concentration, mol_per_metre_cub, dim_substance, dim_length> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using concentration = quantity<dim_concentration, U, Rep>; using concentration = quantity<dim_concentration, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -49,7 +49,7 @@ struct yottasiemens : prefixed_unit<yottasiemens, yotta, siemens> {};
struct dim_conductance : physical::dim_conductance<dim_conductance, siemens, dim_resistance> {}; struct dim_conductance : physical::dim_conductance<dim_conductance, siemens, dim_resistance> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using conductance = quantity<dim_conductance, U, Rep>; using conductance = quantity<dim_conductance, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -32,31 +32,31 @@
namespace units::physical::si::si2019 { namespace units::physical::si::si2019 {
template<Scalar Rep = double> template<ScalableNumber Rep = double>
inline constexpr auto planck_constant = energy<joule, Rep>(6.62607015e-34) * time<second, Rep>(1); inline constexpr auto planck_constant = energy<joule, Rep>(6.62607015e-34) * time<second, Rep>(1);
template<Scalar Rep = double> template<ScalableNumber Rep = double>
inline constexpr auto reduced_planck_constant = energy<gigaelectronvolt, Rep>(6.582119569e-10) * time<second, Rep>(1); inline constexpr auto reduced_planck_constant = energy<gigaelectronvolt, Rep>(6.582119569e-10) * time<second, Rep>(1);
template<Scalar Rep = double> template<ScalableNumber Rep = double>
inline constexpr auto elementary_charge = electric_charge<coulomb, Rep>(1.602176634e-19); inline constexpr auto elementary_charge = electric_charge<coulomb, Rep>(1.602176634e-19);
template<Scalar Rep = double> template<ScalableNumber Rep = double>
inline constexpr auto boltzmann_constant = energy<joule, Rep>(1.380649e-23) / temperature<kelvin, Rep>(1); inline constexpr auto boltzmann_constant = energy<joule, Rep>(1.380649e-23) / temperature<kelvin, Rep>(1);
template<Scalar Rep = double> template<ScalableNumber Rep = double>
inline constexpr auto avogadro_constant = Rep(6.02214076e23) / substance<mole, Rep>(1); inline constexpr auto avogadro_constant = Rep(6.02214076e23) / substance<mole, Rep>(1);
template<Scalar Rep = double> template<ScalableNumber Rep = double>
inline constexpr auto speed_of_light = speed<metre_per_second, Rep>(299'792'458); inline constexpr auto speed_of_light = speed<metre_per_second, Rep>(299'792'458);
template<Scalar Rep = double> template<ScalableNumber Rep = double>
inline constexpr auto hyperfine_structure_transition_frequency = frequency<hertz, Rep>(9'192'631'770); inline constexpr auto hyperfine_structure_transition_frequency = frequency<hertz, Rep>(9'192'631'770);
// template<Scalar Rep = double> // template<ScalableNumber Rep = double>
// inline constexpr auto luminous_efficacy = 683q_lm / 1q_W; // inline constexpr auto luminous_efficacy = 683q_lm / 1q_W;
template<Scalar Rep = double> template<ScalableNumber Rep = double>
inline constexpr auto standard_gravity = acceleration<metre_per_second_sq, Rep>(9.80665); inline constexpr auto standard_gravity = acceleration<metre_per_second_sq, Rep>(9.80665);
} // namespace units::physical::si::si2019 } // namespace units::physical::si::si2019

View File

@ -52,7 +52,7 @@ struct yottaampere : prefixed_unit<yottaampere, yotta, ampere> {};
struct dim_electric_current : physical::dim_electric_current<ampere> {}; struct dim_electric_current : physical::dim_electric_current<ampere> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using current = quantity<dim_electric_current, U, Rep>; using current = quantity<dim_electric_current, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -34,7 +34,7 @@ struct ampere_per_metre_sq : unit<ampere_per_metre_sq> {};
struct dim_current_density : physical::dim_current_density<dim_current_density, ampere_per_metre_sq, dim_electric_current, dim_length> {}; struct dim_current_density : physical::dim_current_density<dim_current_density, ampere_per_metre_sq, dim_electric_current, dim_length> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using current_density = quantity<dim_current_density, U, Rep>; using current_density = quantity<dim_current_density, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -34,7 +34,7 @@ struct kilogram_per_metre_cub : unit<kilogram_per_metre_cub> {};
struct dim_density : physical::dim_density<dim_density, kilogram_per_metre_cub, dim_mass, dim_length> {}; struct dim_density : physical::dim_density<dim_density, kilogram_per_metre_cub, dim_mass, dim_length> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using density = quantity<dim_density, U, Rep>; using density = quantity<dim_density, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -32,7 +32,7 @@ namespace units::physical::si {
struct pascal_second : unit<pascal_second> {}; struct pascal_second : unit<pascal_second> {};
struct dim_dynamic_viscosity : physical::dim_dynamic_viscosity<dim_dynamic_viscosity, pascal_second, dim_pressure, dim_time> {}; struct dim_dynamic_viscosity : physical::dim_dynamic_viscosity<dim_dynamic_viscosity, pascal_second, dim_pressure, dim_time> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using dynamic_viscosity = quantity<dim_dynamic_viscosity, U, Rep>; using dynamic_viscosity = quantity<dim_dynamic_viscosity, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -33,7 +33,7 @@ struct coulomb : named_unit<coulomb, "C", prefix> {};
struct dim_electric_charge : physical::dim_electric_charge<dim_electric_charge, coulomb, dim_time, dim_electric_current> {}; struct dim_electric_charge : physical::dim_electric_charge<dim_electric_charge, coulomb, dim_time, dim_electric_current> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using electric_charge = quantity<dim_electric_charge, U, Rep>; using electric_charge = quantity<dim_electric_charge, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -31,7 +31,7 @@ namespace units::physical::si {
struct volt_per_metre : unit<volt_per_metre> {}; struct volt_per_metre : unit<volt_per_metre> {};
struct dim_electric_field_strength : physical::dim_electric_field_strength<dim_electric_field_strength, volt_per_metre, dim_voltage, dim_length> {}; struct dim_electric_field_strength : physical::dim_electric_field_strength<dim_electric_field_strength, volt_per_metre, dim_voltage, dim_length> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using electric_field_strength = quantity<dim_electric_field_strength, U, Rep>; using electric_field_strength = quantity<dim_electric_field_strength, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -52,7 +52,7 @@ struct gigaelectronvolt : prefixed_unit<gigaelectronvolt, giga, electronvolt> {}
struct dim_energy : physical::dim_energy<dim_energy, joule, dim_force, dim_length> {}; struct dim_energy : physical::dim_energy<dim_energy, joule, dim_force, dim_length> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using energy = quantity<dim_energy, U, Rep>; using energy = quantity<dim_energy, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -54,7 +54,7 @@ struct yottanewton : prefixed_unit<yottanewton, yotta, newton> {};
struct dim_force : physical::dim_force<dim_force, newton, dim_mass, dim_acceleration> {}; struct dim_force : physical::dim_force<dim_force, newton, dim_mass, dim_acceleration> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using force = quantity<dim_force, U, Rep>; using force = quantity<dim_force, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -48,7 +48,7 @@ struct yottahertz : prefixed_unit<yottahertz, yotta, hertz> {};
struct dim_frequency : physical::dim_frequency<dim_frequency, hertz, dim_time> {}; struct dim_frequency : physical::dim_frequency<dim_frequency, hertz, dim_time> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using frequency = quantity<dim_frequency, U, Rep>; using frequency = quantity<dim_frequency, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -39,13 +39,13 @@ struct dim_heat_capacity : physical::dim_heat_capacity<dim_heat_capacity, joule_
struct dim_specific_heat_capacity : physical::dim_specific_heat_capacity<dim_specific_heat_capacity, joule_per_kilogram_kelvin, dim_heat_capacity, dim_mass> {}; struct dim_specific_heat_capacity : physical::dim_specific_heat_capacity<dim_specific_heat_capacity, joule_per_kilogram_kelvin, dim_heat_capacity, dim_mass> {};
struct dim_molar_heat_capacity : physical::dim_molar_heat_capacity<dim_molar_heat_capacity, joule_per_mole_kelvin, dim_heat_capacity, dim_substance> {}; struct dim_molar_heat_capacity : physical::dim_molar_heat_capacity<dim_molar_heat_capacity, joule_per_mole_kelvin, dim_heat_capacity, dim_substance> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using heat_capacity = quantity<dim_heat_capacity, U, Rep>; using heat_capacity = quantity<dim_heat_capacity, U, Rep>;
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using specific_heat_capacity = quantity<dim_specific_heat_capacity, U, Rep>; using specific_heat_capacity = quantity<dim_specific_heat_capacity, U, Rep>;
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using molar_heat_capacity = quantity<dim_molar_heat_capacity, U, Rep>; using molar_heat_capacity = quantity<dim_molar_heat_capacity, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -50,7 +50,7 @@ struct yottahenry : prefixed_unit<yottahenry, yotta, henry> {};
struct dim_inductance : physical::dim_inductance<dim_inductance, henry, dim_magnetic_flux, dim_electric_current> {}; struct dim_inductance : physical::dim_inductance<dim_inductance, henry, dim_magnetic_flux, dim_electric_current> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using inductance = quantity<dim_inductance, U, Rep>; using inductance = quantity<dim_inductance, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -54,7 +54,7 @@ struct astronomical_unit : named_scaled_unit<astronomical_unit, "au", no_prefix,
struct dim_length : physical::dim_length<metre> {}; struct dim_length : physical::dim_length<metre> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using length = quantity<dim_length, U, Rep>; using length = quantity<dim_length, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -32,7 +32,7 @@ namespace units::physical::si {
struct candela_per_metre_sq : unit<candela_per_metre_sq> {}; struct candela_per_metre_sq : unit<candela_per_metre_sq> {};
struct dim_luminance : physical::dim_luminance<dim_luminance, candela_per_metre_sq, dim_luminous_intensity, dim_length> {}; struct dim_luminance : physical::dim_luminance<dim_luminance, candela_per_metre_sq, dim_luminous_intensity, dim_length> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using luminance = quantity<dim_luminance, U, Rep>; using luminance = quantity<dim_luminance, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -52,7 +52,7 @@ struct yottacandela : prefixed_unit<yottacandela, yotta, candela> {};
struct dim_luminous_intensity : physical::dim_luminous_intensity<candela> {}; struct dim_luminous_intensity : physical::dim_luminous_intensity<candela> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using luminous_intensity = quantity<dim_luminous_intensity, U, Rep>; using luminous_intensity = quantity<dim_luminous_intensity, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -50,7 +50,7 @@ struct yottaweber : prefixed_unit<yottaweber, yotta, weber> {};
struct dim_magnetic_flux : physical::dim_magnetic_flux<dim_magnetic_flux, weber, dim_magnetic_induction, dim_area> {}; struct dim_magnetic_flux : physical::dim_magnetic_flux<dim_magnetic_flux, weber, dim_magnetic_induction, dim_area> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using magnetic_flux = quantity<dim_magnetic_flux, U, Rep>; using magnetic_flux = quantity<dim_magnetic_flux, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -54,7 +54,7 @@ struct gauss : named_scaled_unit<gauss, "G", prefix, ratio(1, 10'000), tesla> {}
struct dim_magnetic_induction : physical::dim_magnetic_induction<dim_magnetic_induction, tesla, dim_voltage, dim_time, dim_length> {}; struct dim_magnetic_induction : physical::dim_magnetic_induction<dim_magnetic_induction, tesla, dim_voltage, dim_time, dim_length> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using magnetic_induction = quantity<dim_magnetic_induction, U, Rep>; using magnetic_induction = quantity<dim_magnetic_induction, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -76,7 +76,7 @@ struct dalton : named_scaled_unit<dalton, "Da", no_prefix, ratio(16'605'390'666'
struct dim_mass : physical::dim_mass<kilogram> {}; struct dim_mass : physical::dim_mass<kilogram> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using mass = quantity<dim_mass, U, Rep>; using mass = quantity<dim_mass, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -34,7 +34,7 @@ struct joule_per_mole : unit<joule_per_mole> {};
struct dim_molar_energy : physical::dim_molar_energy<dim_molar_energy, joule_per_mole, dim_energy, dim_substance> {}; struct dim_molar_energy : physical::dim_molar_energy<dim_molar_energy, joule_per_mole, dim_energy, dim_substance> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using molar_energy = quantity<dim_molar_energy, U, Rep>; using molar_energy = quantity<dim_molar_energy, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -32,7 +32,7 @@ namespace units::physical::si {
struct kilogram_metre_per_second : unit<kilogram_metre_per_second> {}; struct kilogram_metre_per_second : unit<kilogram_metre_per_second> {};
struct dim_momentum : physical::dim_momentum<dim_momentum, kilogram_metre_per_second, dim_mass, dim_speed> {}; struct dim_momentum : physical::dim_momentum<dim_momentum, kilogram_metre_per_second, dim_mass, dim_speed> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using momentum = quantity<dim_momentum, U, Rep>; using momentum = quantity<dim_momentum, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -33,7 +33,7 @@ struct henry_per_metre : unit<henry_per_metre> {};
struct dim_permeability : physical::dim_permeability<dim_permeability, henry_per_metre, dim_inductance, dim_length> {}; struct dim_permeability : physical::dim_permeability<dim_permeability, henry_per_metre, dim_inductance, dim_length> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using permeability = quantity<dim_permeability, U, Rep>; using permeability = quantity<dim_permeability, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -33,7 +33,7 @@ struct farad_per_metre : unit<farad_per_metre> {};
struct dim_permittivity : physical::dim_permittivity<dim_permittivity, farad_per_metre, dim_capacitance, dim_length> {}; struct dim_permittivity : physical::dim_permittivity<dim_permittivity, farad_per_metre, dim_capacitance, dim_length> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using permittivity = quantity<dim_permittivity, U, Rep>; using permittivity = quantity<dim_permittivity, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -49,7 +49,7 @@ struct yottawatt : prefixed_unit<yottawatt, yotta, watt> {};
struct dim_power : physical::dim_power<dim_power, watt, dim_energy, dim_time> {}; struct dim_power : physical::dim_power<dim_power, watt, dim_energy, dim_time> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using power = quantity<dim_power, U, Rep>; using power = quantity<dim_power, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -54,7 +54,7 @@ struct yottapascal : prefixed_unit<yottapascal, yotta, pascal> {};
struct dim_pressure : physical::dim_pressure<dim_pressure, pascal, dim_force, dim_area> {}; struct dim_pressure : physical::dim_pressure<dim_pressure, pascal, dim_force, dim_area> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using pressure = quantity<dim_pressure, U, Rep>; using pressure = quantity<dim_pressure, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -50,7 +50,7 @@ struct yottaohm : prefixed_unit<yottaohm, yotta, ohm> {};
struct dim_resistance : physical::dim_resistance<dim_resistance, ohm, dim_voltage, dim_electric_current> {}; struct dim_resistance : physical::dim_resistance<dim_resistance, ohm, dim_voltage, dim_electric_current> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using resistance = quantity<dim_resistance, U, Rep>; using resistance = quantity<dim_resistance, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -34,7 +34,7 @@ struct dim_speed : physical::dim_speed<dim_speed, metre_per_second, dim_length,
struct kilometre_per_hour : deduced_unit<kilometre_per_hour, dim_speed, kilometre, hour> {}; struct kilometre_per_hour : deduced_unit<kilometre_per_hour, dim_speed, kilometre, hour> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using speed = quantity<dim_speed, U, Rep>; using speed = quantity<dim_speed, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -32,7 +32,7 @@ struct mole : named_unit<mole, "mol", prefix> {};
struct dim_substance : physical::dim_substance<mole> {}; struct dim_substance : physical::dim_substance<mole> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using substance = quantity<dim_substance, U, Rep>; using substance = quantity<dim_substance, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -32,7 +32,7 @@ struct newton_per_metre : unit<newton_per_metre> {};
struct dim_surface_tension : physical::dim_surface_tension<dim_surface_tension, newton_per_metre, dim_force, dim_length> {}; struct dim_surface_tension : physical::dim_surface_tension<dim_surface_tension, newton_per_metre, dim_force, dim_length> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using surface_tension = quantity<dim_surface_tension, U, Rep>; using surface_tension = quantity<dim_surface_tension, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -31,7 +31,7 @@ struct kelvin : named_unit<kelvin, "K", no_prefix> {};
struct dim_thermodynamic_temperature : physical::dim_thermodynamic_temperature<kelvin> {}; struct dim_thermodynamic_temperature : physical::dim_thermodynamic_temperature<kelvin> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using temperature = quantity<dim_thermodynamic_temperature, U, Rep>; using temperature = quantity<dim_thermodynamic_temperature, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -33,7 +33,7 @@ struct watt_per_metre_kelvin : unit<watt_per_metre_kelvin> {};
struct dim_thermal_conductivity : physical::dim_thermal_conductivity<dim_thermal_conductivity, watt_per_metre_kelvin, dim_power, dim_length, dim_thermodynamic_temperature> {}; struct dim_thermal_conductivity : physical::dim_thermal_conductivity<dim_thermal_conductivity, watt_per_metre_kelvin, dim_power, dim_length, dim_thermodynamic_temperature> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using thermal_conductivity = quantity<dim_thermal_conductivity, U, Rep>; using thermal_conductivity = quantity<dim_thermal_conductivity, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -43,7 +43,7 @@ struct day : named_scaled_unit<hour, "d", no_prefix, ratio(24), hour> {};
struct dim_time : physical::dim_time<second> {}; struct dim_time : physical::dim_time<second> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using time = quantity<dim_time, U, Rep>; using time = quantity<dim_time, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -34,7 +34,7 @@ struct newton_metre : named_unit<newton_metre, "Nm", prefix> {};
struct dim_torque : physical::dim_torque<dim_torque, newton_metre, dim_energy, dim_angle> {}; struct dim_torque : physical::dim_torque<dim_torque, newton_metre, dim_energy, dim_angle> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using torque = quantity<dim_torque, U, Rep>; using torque = quantity<dim_torque, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -54,7 +54,7 @@ struct yottavolt : prefixed_unit<yottavolt, yotta, volt> {};
struct dim_voltage : physical::dim_voltage<dim_voltage, volt, dim_power, dim_electric_current> {}; struct dim_voltage : physical::dim_voltage<dim_voltage, volt, dim_power, dim_electric_current> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using voltage = quantity<dim_voltage, U, Rep>; using voltage = quantity<dim_voltage, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -74,7 +74,7 @@ struct exalitre : prefixed_unit<petalitre, exa, litre> {};
struct zettalitre : prefixed_alias_unit<cubic_megametre, zetta, litre> {}; struct zettalitre : prefixed_alias_unit<cubic_megametre, zetta, litre> {};
struct yottalitre : prefixed_unit<yottalitre, yotta, litre> {}; struct yottalitre : prefixed_unit<yottalitre, yotta, litre> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using volume = quantity<dim_volume, U, Rep>; using volume = quantity<dim_volume, U, Rep>;
inline namespace literals { inline namespace literals {

View File

@ -58,7 +58,7 @@ concept safe_divisible = // exposition only
* @tparam U a measurement unit of the quantity * @tparam U a measurement unit of the quantity
* @tparam Rep a type to be used to represent values of a quantity * @tparam Rep a type to be used to represent values of a quantity
*/ */
template<Dimension D, UnitOf<D> U, Scalar Rep = double> template<Dimension D, UnitOf<D> U, ScalableNumber Rep = double>
class quantity { class quantity {
Rep value_{}; Rep value_{};
@ -71,7 +71,7 @@ public:
quantity(const quantity&) = default; quantity(const quantity&) = default;
quantity(quantity&&) = default; quantity(quantity&&) = default;
template<Scalar Value> template<ScalableNumber Value>
requires detail::safe_convertible<Value, rep> requires detail::safe_convertible<Value, rep>
constexpr explicit(!(std::is_same_v<dimension, dim_one> && std::is_same_v<unit, unitless>)) quantity(const Value& v) : value_{static_cast<rep>(v)} {} constexpr explicit(!(std::is_same_v<dimension, dim_one> && std::is_same_v<unit, unitless>)) quantity(const Value& v) : value_{static_cast<rep>(v)} {}
@ -176,7 +176,7 @@ public:
return *this; return *this;
} }
template<Scalar Value> template<ScalableNumber Value>
requires (!treat_as_floating_point<rep>) && requires (!treat_as_floating_point<rep>) &&
(!treat_as_floating_point<Value>) (!treat_as_floating_point<Value>)
constexpr quantity& operator%=(const Value& rhs) constexpr quantity& operator%=(const Value& rhs)
@ -227,7 +227,7 @@ public:
return ret(ret(lhs).count() - ret(rhs).count()); return ret(ret(lhs).count() - ret(rhs).count());
} }
template<Scalar Value> template<ScalableNumber Value>
requires std::regular_invocable<std::multiplies<>, Rep, Value> requires std::regular_invocable<std::multiplies<>, Rep, Value>
[[nodiscard]] friend constexpr Quantity auto operator*(const quantity& q, const Value& v) [[nodiscard]] friend constexpr Quantity auto operator*(const quantity& q, const Value& v)
{ {
@ -236,7 +236,7 @@ public:
return ret(q.count() * v); return ret(q.count() * v);
} }
template<Scalar Value> template<ScalableNumber Value>
requires std::regular_invocable<std::multiplies<>, Value, Rep> requires std::regular_invocable<std::multiplies<>, Value, Rep>
[[nodiscard]] friend constexpr Quantity auto operator*(const Value& v, const quantity& q) [[nodiscard]] friend constexpr Quantity auto operator*(const Value& v, const quantity& q)
{ {
@ -254,7 +254,7 @@ public:
return ret(lhs.count() * rhs.count()); return ret(lhs.count() * rhs.count());
} }
template<Scalar Value> template<ScalableNumber Value>
requires std::regular_invocable<std::divides<>, Value, Rep> requires std::regular_invocable<std::divides<>, Value, Rep>
[[nodiscard]] friend constexpr Quantity auto operator/(const Value& v, const quantity& q) [[nodiscard]] friend constexpr Quantity auto operator/(const Value& v, const quantity& q)
{ {
@ -267,7 +267,7 @@ public:
return ret(v / q.count()); return ret(v / q.count());
} }
template<Scalar Value> template<ScalableNumber Value>
requires std::regular_invocable<std::divides<>, Rep, Value> requires std::regular_invocable<std::divides<>, Rep, Value>
[[nodiscard]] friend constexpr Quantity auto operator/(const quantity& q, const Value& v) [[nodiscard]] friend constexpr Quantity auto operator/(const quantity& q, const Value& v)
{ {
@ -291,7 +291,7 @@ public:
return ret(lhs.count() / rhs.count()); return ret(lhs.count() / rhs.count());
} }
template<Scalar Value> template<ScalableNumber Value>
requires (!treat_as_floating_point<Rep>) && requires (!treat_as_floating_point<Rep>) &&
(!treat_as_floating_point<Value>) && (!treat_as_floating_point<Value>) &&
std::regular_invocable<std::modulus<>, Rep, Value> std::regular_invocable<std::modulus<>, Rep, Value>

View File

@ -36,10 +36,10 @@
namespace units { namespace units {
template<Dimension D, UnitOf<D> U, Scalar Rep> template<Dimension D, UnitOf<D> U, ScalableNumber Rep>
class quantity; class quantity;
template<Dimension D, UnitOf<D> U, Scalar Rep> template<Dimension D, UnitOf<D> U, ScalableNumber Rep>
class quantity_point; class quantity_point;
namespace detail { namespace detail {
@ -374,7 +374,7 @@ template<Unit ToU, typename D, typename U, typename Rep>
* *
* @tparam ToRep a representation type to use for a target quantity * @tparam ToRep a representation type to use for a target quantity
*/ */
template<Scalar ToRep, typename D, typename U, typename Rep> template<ScalableNumber ToRep, typename D, typename U, typename Rep>
[[nodiscard]] constexpr auto quantity_cast(const quantity<D, U, Rep>& q) [[nodiscard]] constexpr auto quantity_cast(const quantity<D, U, Rep>& q)
{ {
return quantity_cast<quantity<D, U, ToRep>>(q); return quantity_cast<quantity<D, U, ToRep>>(q);

View File

@ -37,7 +37,7 @@ namespace units {
* @tparam U a measurement unit of the quantity point * @tparam U a measurement unit of the quantity point
* @tparam Rep a type to be used to represent values of a quantity point * @tparam Rep a type to be used to represent values of a quantity point
*/ */
template<Dimension D, UnitOf<D> U, Scalar Rep = double> template<Dimension D, UnitOf<D> U, ScalableNumber Rep = double>
class quantity_point { class quantity_point {
public: public:
using quantity_type = quantity<D, U, Rep>; using quantity_type = quantity<D, U, Rep>;

View File

@ -86,7 +86,7 @@ using impl_impl = impl_constructible_impl_convertible<T>;
static_assert(std::convertible_to<float, impl_impl<float>>); static_assert(std::convertible_to<float, impl_impl<float>>);
static_assert(std::convertible_to<impl_impl<float>, float>); static_assert(std::convertible_to<impl_impl<float>, float>);
static_assert(units::Scalar<impl_impl<float>>); static_assert(units::ScalableNumber<impl_impl<float>>);
template<typename T> template<typename T>
struct expl_constructible_impl_convertible : scalar_ops<expl_constructible_impl_convertible<T>> { struct expl_constructible_impl_convertible : scalar_ops<expl_constructible_impl_convertible<T>> {
@ -101,7 +101,7 @@ using expl_impl = expl_constructible_impl_convertible<T>;
static_assert(!std::convertible_to<float, expl_impl<float>>); static_assert(!std::convertible_to<float, expl_impl<float>>);
static_assert(std::convertible_to<expl_impl<float>, float>); static_assert(std::convertible_to<expl_impl<float>, float>);
static_assert(units::Scalar<expl_impl<float>>); static_assert(units::ScalableNumber<expl_impl<float>>);
template<typename T> template<typename T>
struct impl_constructible_expl_convertible : scalar_ops<impl_constructible_expl_convertible<T>> { struct impl_constructible_expl_convertible : scalar_ops<impl_constructible_expl_convertible<T>> {
@ -116,7 +116,7 @@ using impl_expl = impl_constructible_expl_convertible<T>;
static_assert(std::convertible_to<float, impl_expl<float>>); static_assert(std::convertible_to<float, impl_expl<float>>);
static_assert(!std::convertible_to<impl_expl<float>, float>); static_assert(!std::convertible_to<impl_expl<float>, float>);
static_assert(units::Scalar<impl_expl<float>>); static_assert(units::ScalableNumber<impl_expl<float>>);
template<typename T> template<typename T>
struct expl_constructible_expl_convertible : scalar_ops<expl_constructible_expl_convertible<T>> { struct expl_constructible_expl_convertible : scalar_ops<expl_constructible_expl_convertible<T>> {
@ -131,7 +131,7 @@ using expl_expl = expl_constructible_expl_convertible<T>;
static_assert(!std::convertible_to<float, expl_expl<float>>); static_assert(!std::convertible_to<float, expl_expl<float>>);
static_assert(!std::convertible_to<expl_expl<float>, float>); static_assert(!std::convertible_to<expl_expl<float>, float>);
static_assert(units::Scalar<expl_expl<float>>); static_assert(units::ScalableNumber<expl_expl<float>>);
} // namespace } // namespace
@ -170,7 +170,7 @@ using namespace units::physical::si;
// constructors // constructors
// Quantity from Scalar // Quantity from ScalableNumber
// int <- int // int <- int
static_assert(length<metre, int>(expl_impl<int>(1)).count() == 1); static_assert(length<metre, int>(expl_impl<int>(1)).count() == 1);
static_assert(!std::is_constructible_v<length<metre, int>, impl_expl<int>>); static_assert(!std::is_constructible_v<length<metre, int>, impl_expl<int>>);

View File

@ -35,14 +35,14 @@ using namespace units::physical::si;
struct sq_volt_per_hertz : unit<sq_volt_per_hertz> {}; struct sq_volt_per_hertz : unit<sq_volt_per_hertz> {};
struct dim_power_spectral_density : derived_dimension<dim_power_spectral_density, sq_volt_per_hertz, units::exponent<dim_voltage, 2>, units::exponent<dim_frequency, -1>> {}; struct dim_power_spectral_density : derived_dimension<dim_power_spectral_density, sq_volt_per_hertz, units::exponent<dim_voltage, 2>, units::exponent<dim_frequency, -1>> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using power_spectral_density = quantity<dim_power_spectral_density, U, Rep>; using power_spectral_density = quantity<dim_power_spectral_density, U, Rep>;
// amplitude spectral density // amplitude spectral density
struct volt_per_sqrt_hertz : unit<volt_per_sqrt_hertz> {}; struct volt_per_sqrt_hertz : unit<volt_per_sqrt_hertz> {};
struct dim_amplitude_spectral_density : derived_dimension<dim_amplitude_spectral_density, volt_per_sqrt_hertz, units::exponent<dim_voltage, 1>, units::exponent<dim_frequency, -1, 2>> {}; struct dim_amplitude_spectral_density : derived_dimension<dim_amplitude_spectral_density, volt_per_sqrt_hertz, units::exponent<dim_voltage, 1>, units::exponent<dim_frequency, -1, 2>> {};
template<Unit U, Scalar Rep = double> template<Unit U, ScalableNumber Rep = double>
using amplitude_spectral_density = quantity<dim_amplitude_spectral_density, U, Rep>; using amplitude_spectral_density = quantity<dim_amplitude_spectral_density, U, Rep>;
} }