mirror of
https://github.com/mpusz/mp-units.git
synced 2025-07-30 02:17:16 +02:00
refactor: QuantityValue
concept renamed to Representation
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
# Release notes
|
||||
|
||||
- **0.7.0 WIP**
|
||||
- (!) refactor: `ScalableNumber` renamed to `QuantityValue`
|
||||
- (!) refactor: `ScalableNumber` renamed to `Representation`
|
||||
- (!) refactor: output stream operators moved to the `units/quantity_io.h` header file
|
||||
- (!) refactor: Refactored the library file tree
|
||||
- (!) refactor: `quantity::count()` renamed to `quantity::number()`
|
||||
|
@ -11,7 +11,7 @@ Interface
|
||||
The difference is that it uses ``double`` as a default representation and has
|
||||
a few additional member types and functions::
|
||||
|
||||
template<Dimension D, UnitOf<D> U, QuantityValue Rep = double>
|
||||
template<Dimension D, UnitOf<D> U, Representation Rep = double>
|
||||
class quantity {
|
||||
public:
|
||||
using dimension = D;
|
||||
@ -27,7 +27,7 @@ a few additional member types and functions::
|
||||
[[nodiscard]] constexpr Quantity auto operator*(const quantity<D1, U1, Rep1>& lhs,
|
||||
const quantity<D2, U2, Rep2>& rhs);
|
||||
|
||||
template<QuantityValue Value, typename D, typename U, typename Rep>
|
||||
template<Representation Value, typename D, typename U, typename Rep>
|
||||
requires std::magma<std::ranges::divided_by, Value, Rep>
|
||||
[[nodiscard]] constexpr Quantity auto operator/(const Value& v,
|
||||
const quantity<D, U, Rep>& q);
|
||||
|
@ -18,7 +18,7 @@ For example the speed of light constant in :term:`SI` is defined as::
|
||||
|
||||
namespace si::si2019 {
|
||||
|
||||
template<QuantityValue Rep = double>
|
||||
template<Representation Rep = double>
|
||||
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 {
|
||||
|
||||
template<QuantityValue Rep = double>
|
||||
template<Representation Rep = double>
|
||||
inline constexpr auto speed_of_light = speed<one, Rep>(1);
|
||||
|
||||
}
|
||||
|
@ -79,8 +79,8 @@ you can use a quantity argument instead of a quantity kind.
|
||||
struct height_kind : kind<height_kind, dim_length> {};
|
||||
struct rate_of_climb_kind : derived_kind<rate_of_climb_kind, height_kind, dim_speed> {};
|
||||
|
||||
template <Unit U, QuantityValue Rep = double> using height = quantity_kind<height_kind, U, Rep>;
|
||||
template <Unit U, QuantityValue Rep = double> using rate_of_climb = quantity_kind<rate_of_climb_kind, U, Rep>;
|
||||
template <Unit U, Representation Rep = double> using height = quantity_kind<height_kind, U, Rep>;
|
||||
template <Unit U, Representation Rep = double> using rate_of_climb = quantity_kind<rate_of_climb_kind, U, Rep>;
|
||||
|
||||
height h{100 * m};
|
||||
rate_of_climb rate = h / (25 * s);
|
||||
@ -92,8 +92,8 @@ you can use a quantity argument instead of a quantity kind.
|
||||
struct width_kind : kind<width_kind, dim_length> {};
|
||||
struct horizontal_area_kind : derived_kind<horizontal_area_kind, width_kind, dim_area> {};
|
||||
|
||||
template <Unit U, QuantityValue Rep = double> using width = quantity_kind<width_kind, U, Rep>;
|
||||
template <Unit U, QuantityValue Rep = double> using horizontal_area = quantity_kind<horizontal_area_kind, U, Rep>;
|
||||
template <Unit U, Representation Rep = double> using width = quantity_kind<width_kind, U, Rep>;
|
||||
template <Unit U, Representation Rep = double> using horizontal_area = quantity_kind<horizontal_area_kind, U, Rep>;
|
||||
|
||||
width w{5 * m};
|
||||
horizontal_area area1 = w * w;
|
||||
|
@ -37,10 +37,10 @@ type to ``double`` by default::
|
||||
|
||||
namespace si {
|
||||
|
||||
template<Unit U, QuantityValue Rep = double>
|
||||
template<Unit U, Representation Rep = double>
|
||||
using length = quantity<dim_length, U, Rep>;
|
||||
|
||||
template<Unit U, QuantityValue Rep = double>
|
||||
template<Unit U, Representation Rep = double>
|
||||
using speed = quantity<dim_speed, U, Rep>;
|
||||
|
||||
}
|
||||
@ -208,7 +208,7 @@ be used::
|
||||
All instances of `quantity` class always match the `Quantity` concept.
|
||||
All other regular types that are not quantities are called
|
||||
:term:`scalable numbers <scalable number>` by the library and match the
|
||||
`QuantityValue` concept.
|
||||
`Representation` concept.
|
||||
|
||||
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
|
||||
@ -318,7 +318,7 @@ are provided::
|
||||
template<typename T>
|
||||
concept Dimensionless = QuantityOf<T, dim_one>;
|
||||
|
||||
template<Unit U, QuantityValue Rep = double>
|
||||
template<Unit U, Representation Rep = double>
|
||||
using dimensionless = quantity<dim_one, U, Rep>;
|
||||
|
||||
There are two special units provided for usage with such a quantity:
|
||||
|
@ -68,7 +68,7 @@ Concepts
|
||||
satisfy :expr:`Quantity<typename T::value_type> || QuantityLike<typename T::value_type>` recursively
|
||||
(i.e. ``std::optional<si::length<si::metre>>``).
|
||||
|
||||
.. concept:: template<typename T> QuantityValue
|
||||
.. concept:: template<typename T> Representation
|
||||
|
||||
A concept matching types that can be used as a `Quantity` representation type. Satisfied
|
||||
by types that match ``(!Quantity<T>) && (!QuantityLike<T>) && (!WrappedQuantity<T>) && std::regular<T>``
|
||||
|
@ -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).
|
||||
|
||||
|
||||
A `QuantityValue` concept
|
||||
A `Representation` concept
|
||||
--------------------------
|
||||
|
||||
To support a minimum set of `quantity` operations all custom representation types have to
|
||||
satisfy at least the `QuantityValue` concept. Which means that they:
|
||||
satisfy at least the `Representation` concept. Which means that they:
|
||||
|
||||
- cannot be quantities by themselves,
|
||||
- cannot be wrappers over the `quantity` type (i.e. ``std::optional<si::length<si::metre>>``),
|
||||
@ -103,7 +103,7 @@ The only difference here is that in this case we have to explicitly cast the `qu
|
||||
Additional Requirements
|
||||
-----------------------
|
||||
|
||||
As noted in the previous chapter, the `QuantityValue` concept guarantees us the possibility
|
||||
As noted in the previous chapter, the `Representation` concept guarantees us the possibility
|
||||
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
|
||||
have to satisfy more requirements.
|
||||
@ -202,7 +202,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
|
||||
template::
|
||||
|
||||
template<QuantityValue Rep>
|
||||
template<Representation Rep>
|
||||
struct quantity_values {
|
||||
static constexpr Rep zero() noexcept { return Rep(0); }
|
||||
static constexpr Rep one() noexcept { return Rep(1); }
|
||||
@ -223,7 +223,7 @@ types differently than the integral ones. This behavior can also be extended to
|
||||
representation types with `treat_as_floating_point` customization point which default
|
||||
definition is::
|
||||
|
||||
template<QuantityValue Rep>
|
||||
template<Representation 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
|
||||
|
@ -121,7 +121,7 @@ coherent unit::
|
||||
struct desk_per_hour : deduced_unit<desk_per_hour, dim_desk_rate, desk, si::hour> {};
|
||||
|
||||
// a quantity of our dimension
|
||||
template<UnitOf<dim_desk_rate> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_desk_rate> U, Representation Rep = double>
|
||||
using desk_rate = quantity<dim_desk_rate, U, Rep>;
|
||||
|
||||
// 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 dim_people : base_dimension<"people", person> {};
|
||||
|
||||
template<UnitOf<dim_people> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_people> U, Representation Rep = double>
|
||||
using people = quantity<dim_people, U, Rep>;
|
||||
|
||||
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> {};
|
||||
|
||||
template<UnitOf<dim_occupancy_rate> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_occupancy_rate> U, Representation Rep = double>
|
||||
using occupancy_rate = quantity<dim_occupancy_rate, U, Rep>;
|
||||
|
||||
template<typename T>
|
||||
@ -216,7 +216,7 @@ Such units do not share their references with base units of other systems:
|
||||
|
||||
struct dim_length : base_dimension<"L", foot> {};
|
||||
|
||||
template<UnitOf<dim_length> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_length> U, Representation Rep = double>
|
||||
using length = quantity<dim_length, U, Rep>;
|
||||
|
||||
} // namespace fps
|
||||
@ -236,7 +236,7 @@ different systems:
|
||||
|
||||
struct dim_length : base_dimension<"L", metre> {};
|
||||
|
||||
template<UnitOf<dim_length> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_length> U, Representation Rep = double>
|
||||
using length = quantity<dim_length, U, Rep>;
|
||||
|
||||
namespace fps {
|
||||
@ -246,7 +246,7 @@ different systems:
|
||||
|
||||
struct dim_length : base_dimension<"L", foot> {};
|
||||
|
||||
template<UnitOf<dim_length> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_length> U, Representation Rep = double>
|
||||
using length = quantity<dim_length, U, Rep>;
|
||||
|
||||
} // namespace fps
|
||||
|
@ -33,7 +33,7 @@ struct yard : named_scaled_unit<yard, "yd", no_prefix, ratio(3), foot> {};
|
||||
|
||||
struct dim_length : base_dimension<"L", foot> {};
|
||||
|
||||
template<UnitOf<dim_length> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_length> U, Representation Rep = double>
|
||||
using length = quantity<dim_length, U, Rep>;
|
||||
|
||||
} // namespace fps
|
||||
@ -45,7 +45,7 @@ struct kilometre : prefixed_unit<kilometre, units::isq::si::kilo, metre> {};
|
||||
|
||||
struct dim_length : base_dimension<"L", metre> {};
|
||||
|
||||
template<UnitOf<dim_length> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_length> U, Representation Rep = double>
|
||||
using length = quantity<dim_length, U, Rep>;
|
||||
|
||||
namespace fps {
|
||||
@ -55,7 +55,7 @@ struct yard : named_scaled_unit<yard, "yd", no_prefix, ratio(3), foot> {};
|
||||
|
||||
struct dim_length : base_dimension<"L", foot> {};
|
||||
|
||||
template<UnitOf<dim_length> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_length> U, Representation Rep = double>
|
||||
using length = quantity<dim_length, U, Rep>;
|
||||
|
||||
} // namespace fps
|
||||
|
@ -204,10 +204,10 @@ void matrix_of_quantity_tests()
|
||||
matrix_of_quantity_divide_by_scalar();
|
||||
}
|
||||
|
||||
template<units::Unit U = si::metre, units::QuantityValue Rep = double>
|
||||
template<units::Unit U = si::metre, units::Representation Rep = double>
|
||||
using length_v = si::length<U, vector<Rep>>;
|
||||
|
||||
template<units::Unit U = si::newton, units::QuantityValue Rep = double>
|
||||
template<units::Unit U = si::newton, units::Representation Rep = double>
|
||||
using force_v = si::force<U, vector<Rep>>;
|
||||
|
||||
void quantity_of_vector_add()
|
||||
@ -277,7 +277,7 @@ void quantity_of_vector_tests()
|
||||
quantity_of_vector_divide_by_scalar();
|
||||
}
|
||||
|
||||
template<units::Unit U = si::metre, units::QuantityValue Rep = double>
|
||||
template<units::Unit U = si::metre, units::Representation Rep = double>
|
||||
using length_m = si::length<U, matrix<Rep>>;
|
||||
|
||||
void quantity_of_matrix_add()
|
||||
|
@ -120,7 +120,7 @@ private:
|
||||
|
||||
namespace {
|
||||
|
||||
static_assert(units::QuantityValue<measurement<double>>);
|
||||
static_assert(units::Representation<measurement<double>>);
|
||||
|
||||
void example()
|
||||
{
|
||||
|
@ -337,7 +337,7 @@ concept QuantityLike = detail::is_quantity_like<T>;
|
||||
template<typename T>
|
||||
concept QuantityPointLike = detail::is_quantity_point_like<T>;
|
||||
|
||||
// QuantityValue
|
||||
// Representation
|
||||
|
||||
template<typename T, typename U>
|
||||
concept common_type_with_ = // exposition only
|
||||
@ -397,7 +397,7 @@ concept wrapped_quantity_ = // exposition only
|
||||
* Satisfied by types that satisfy `(!Quantity<T>) && (!WrappedQuantity<T>) && std::regular<T>`.
|
||||
*/
|
||||
template<typename T>
|
||||
concept QuantityValue =
|
||||
concept Representation =
|
||||
(!Quantity<T>) &&
|
||||
(!QuantityLike<T>) &&
|
||||
(!wrapped_quantity_<T>) &&
|
||||
@ -413,7 +413,7 @@ template<typename T>
|
||||
typename quantity_like_traits<T>::rep;
|
||||
requires Dimension<typename quantity_like_traits<T>::dimension>;
|
||||
requires Unit<typename quantity_like_traits<T>::unit>;
|
||||
requires QuantityValue<typename quantity_like_traits<T>::rep>;
|
||||
requires Representation<typename quantity_like_traits<T>::rep>;
|
||||
{ quantity_like_traits<T>::number(q) } -> std::convertible_to<typename quantity_like_traits<T>::rep>;
|
||||
}
|
||||
inline constexpr bool is_quantity_like<T> = true;
|
||||
@ -425,7 +425,7 @@ template<typename T>
|
||||
typename quantity_point_like_traits<T>::rep;
|
||||
requires Dimension<typename quantity_point_like_traits<T>::dimension>;
|
||||
requires Unit<typename quantity_point_like_traits<T>::unit>;
|
||||
requires QuantityValue<typename quantity_point_like_traits<T>::rep>;
|
||||
requires Representation<typename quantity_point_like_traits<T>::rep>;
|
||||
{ quantity_point_like_traits<T>::relative(q) } -> QuantityLike;
|
||||
}
|
||||
inline constexpr bool is_quantity_point_like<T> = true;
|
||||
|
@ -28,16 +28,16 @@
|
||||
|
||||
namespace units {
|
||||
|
||||
template<Dimension D, UnitOf<D> U, QuantityValue Rep>
|
||||
template<Dimension D, UnitOf<D> U, Representation Rep>
|
||||
class quantity;
|
||||
|
||||
template<Dimension D, UnitOf<D> U, QuantityValue Rep>
|
||||
template<Dimension D, UnitOf<D> U, Representation Rep>
|
||||
class quantity_point;
|
||||
|
||||
template<Kind K, UnitOf<typename K::dimension> U, QuantityValue Rep>
|
||||
template<Kind K, UnitOf<typename K::dimension> U, Representation Rep>
|
||||
class quantity_kind;
|
||||
|
||||
template<PointKind PK, UnitOf<typename PK::dimension> U, QuantityValue Rep>
|
||||
template<PointKind PK, UnitOf<typename PK::dimension> U, Representation Rep>
|
||||
class quantity_point_kind;
|
||||
|
||||
namespace detail {
|
||||
@ -73,7 +73,7 @@ struct common_quantity_impl<quantity<D1, U1, Rep1>, quantity<D2, U2, Rep2>, Rep>
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template<Quantity Q1, QuantityEquivalentTo<Q1> Q2, QuantityValue Rep = std::common_type_t<typename Q1::rep, typename Q2::rep>>
|
||||
template<Quantity Q1, QuantityEquivalentTo<Q1> Q2, Representation Rep = std::common_type_t<typename Q1::rep, typename Q2::rep>>
|
||||
using common_quantity = TYPENAME detail::common_quantity_impl<Q1, Q2, Rep>::type;
|
||||
|
||||
template<QuantityPoint QP1, QuantityPointEquivalentTo<QP1> QP2>
|
||||
|
@ -35,7 +35,7 @@ struct dim_angle : base_dimension<"A", U> {};
|
||||
template<typename T>
|
||||
concept Angle = QuantityOfT<T, dim_angle>;
|
||||
|
||||
template<UnitOf<dim_angle<>> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_angle<>> U, Representation Rep = double>
|
||||
using angle = quantity<dim_angle<>, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -40,7 +40,7 @@ struct dim_one : derived_dimension<dim_one, one> {};
|
||||
template<typename T>
|
||||
concept Dimensionless = QuantityOf<T, dim_one>;
|
||||
|
||||
template<UnitOf<dim_one> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_one> U, Representation Rep = double>
|
||||
using dimensionless = quantity<dim_one, U, Rep>;
|
||||
|
||||
} // namespace units
|
||||
|
@ -73,11 +73,11 @@ concept safe_castable_to_ = // exposition only
|
||||
template<typename Func, typename T, typename U>
|
||||
concept quantity_value_for_ =
|
||||
std::regular_invocable<Func, T, U> &&
|
||||
QuantityValue<std::invoke_result_t<Func, T, U>>;
|
||||
Representation<std::invoke_result_t<Func, T, U>>;
|
||||
|
||||
template<typename T, typename Func, typename U, typename V>
|
||||
concept invoke_result_convertible_to_ =
|
||||
QuantityValue<T> &&
|
||||
Representation<T> &&
|
||||
quantity_value_for_<Func, U, V> &&
|
||||
safe_convertible_to_<T, std::invoke_result_t<Func, U, V>>;
|
||||
|
||||
@ -104,7 +104,7 @@ using quantity_like_type = quantity<typename quantity_like_traits<Q>::dimension,
|
||||
* @tparam U a measurement unit of the quantity
|
||||
* @tparam Rep a type to be used to represent values of a quantity
|
||||
*/
|
||||
template<Dimension D, UnitOf<D> U, QuantityValue Rep = double>
|
||||
template<Dimension D, UnitOf<D> U, Representation Rep = double>
|
||||
class quantity {
|
||||
Rep number_;
|
||||
public:
|
||||
@ -381,8 +381,8 @@ public:
|
||||
};
|
||||
|
||||
// CTAD
|
||||
template<QuantityValue V>
|
||||
explicit(false) quantity(V) -> quantity<dim_one, one, V>;
|
||||
template<Representation Rep>
|
||||
explicit(false) quantity(Rep) -> quantity<dim_one, one, Rep>;
|
||||
|
||||
template<QuantityLike Q>
|
||||
explicit quantity(Q) -> quantity<typename quantity_like_traits<Q>::dimension, typename quantity_like_traits<Q>::unit, typename quantity_like_traits<Q>::rep>;
|
||||
|
@ -36,16 +36,16 @@
|
||||
|
||||
namespace units {
|
||||
|
||||
template<Dimension D, UnitOf<D> U, QuantityValue Rep>
|
||||
template<Dimension D, UnitOf<D> U, Representation Rep>
|
||||
class quantity;
|
||||
|
||||
template<Dimension D, UnitOf<D> U, QuantityValue Rep>
|
||||
template<Dimension D, UnitOf<D> U, Representation Rep>
|
||||
class quantity_point;
|
||||
|
||||
template<Kind K, UnitOf<typename K::dimension> U, QuantityValue Rep>
|
||||
template<Kind K, UnitOf<typename K::dimension> U, Representation Rep>
|
||||
class quantity_kind;
|
||||
|
||||
template<PointKind PK, UnitOf<typename PK::dimension> U, QuantityValue Rep>
|
||||
template<PointKind PK, UnitOf<typename PK::dimension> U, Representation Rep>
|
||||
class quantity_point_kind;
|
||||
|
||||
namespace detail {
|
||||
@ -211,7 +211,7 @@ template<Dimension ToD, Unit ToU, typename D, typename U, typename Rep>
|
||||
*
|
||||
* @tparam ToRep a representation type to use for a target quantity
|
||||
*/
|
||||
template<QuantityValue ToRep, typename D, typename U, scalable_with_<ToRep> Rep>
|
||||
template<Representation ToRep, typename D, typename U, scalable_with_<ToRep> Rep>
|
||||
requires std::constructible_from<ToRep, std::common_type_t<ToRep, Rep>>
|
||||
[[nodiscard]] constexpr auto quantity_cast(const quantity<D, U, Rep>& q)
|
||||
{
|
||||
|
@ -72,7 +72,7 @@ concept QuantityKindRelatedTo = QuantityKind<QK1> && QuantityKind<QK2> &&
|
||||
* @tparam U the measurement unit of the quantity kind
|
||||
* @tparam Rep the type to be used to represent values of the quantity kind
|
||||
*/
|
||||
template<Kind K, UnitOf<typename K::dimension> U, QuantityValue Rep = double>
|
||||
template<Kind K, UnitOf<typename K::dimension> U, Representation Rep = double>
|
||||
class quantity_kind {
|
||||
public:
|
||||
using kind_type = K;
|
||||
@ -239,21 +239,21 @@ public:
|
||||
|
||||
// Hidden Friends
|
||||
// Below friend functions are to be found via argument-dependent lookup only
|
||||
template<QuantityValue Value>
|
||||
template<Representation Value>
|
||||
[[nodiscard]] friend constexpr QuantityKind auto operator*(const quantity_kind& qk, const Value& v)
|
||||
requires requires(quantity_type q) { { q * v } -> Quantity; }
|
||||
{
|
||||
return detail::make_quantity_kind<quantity_kind>(qk.common() * v);
|
||||
}
|
||||
|
||||
template<QuantityValue Value>
|
||||
template<Representation Value>
|
||||
[[nodiscard]] friend constexpr QuantityKind auto operator*(const Value& v, const quantity_kind& qk)
|
||||
requires requires(quantity_type q) { { v * q } -> Quantity; }
|
||||
{
|
||||
return detail::make_quantity_kind<quantity_kind>(v * qk.common());
|
||||
}
|
||||
|
||||
template<QuantityValue Value>
|
||||
template<Representation Value>
|
||||
[[nodiscard]] friend constexpr QuantityKind auto operator/(const quantity_kind& qk, const Value& v)
|
||||
requires requires(quantity_type q) { { q / v } -> Quantity; }
|
||||
{
|
||||
@ -261,7 +261,7 @@ public:
|
||||
return detail::make_quantity_kind<quantity_kind>(qk.common() / v);
|
||||
}
|
||||
|
||||
template<QuantityValue Value>
|
||||
template<Representation Value>
|
||||
[[nodiscard]] friend constexpr QuantityKind auto operator/(const Value& v, const quantity_kind& qk)
|
||||
requires requires(quantity_type q) { { v / q } -> Quantity; }
|
||||
{
|
||||
@ -269,7 +269,7 @@ public:
|
||||
return detail::downcasted_kind<quantity_kind>(v / qk.common());
|
||||
}
|
||||
|
||||
template<QuantityValue Value>
|
||||
template<Representation Value>
|
||||
[[nodiscard]] friend constexpr QuantityKind auto operator%(const quantity_kind& qk, const Value& v)
|
||||
requires requires(quantity_type q) { q % v; }
|
||||
{
|
||||
|
@ -37,7 +37,7 @@ namespace units {
|
||||
* @tparam U a measurement unit of the quantity point
|
||||
* @tparam Rep a type to be used to represent values of a quantity point
|
||||
*/
|
||||
template<Dimension D, UnitOf<D> U, QuantityValue Rep = double>
|
||||
template<Dimension D, UnitOf<D> U, Representation Rep = double>
|
||||
class quantity_point {
|
||||
public:
|
||||
using quantity_type = quantity<D, U, Rep>;
|
||||
@ -180,8 +180,8 @@ public:
|
||||
|
||||
};
|
||||
|
||||
template<QuantityValue V>
|
||||
explicit(false) quantity_point(V) -> quantity_point<dim_one, one, V>;
|
||||
template<Representation Rep>
|
||||
explicit(false) quantity_point(Rep) -> quantity_point<dim_one, one, Rep>;
|
||||
|
||||
template<QuantityLike Q>
|
||||
quantity_point(Q) -> quantity_point<typename quantity_like_traits<Q>::dimension,
|
||||
|
@ -38,7 +38,7 @@ namespace units {
|
||||
* @tparam U the measurement unit of the quantity point kind
|
||||
* @tparam Rep the type to be used to represent values of the quantity point kind
|
||||
*/
|
||||
template<PointKind PK, UnitOf<typename PK::dimension> U, QuantityValue Rep = double>
|
||||
template<PointKind PK, UnitOf<typename PK::dimension> U, Representation Rep = double>
|
||||
class quantity_point_kind {
|
||||
public:
|
||||
using point_kind_type = PK;
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
namespace units {
|
||||
|
||||
template<Dimension D, UnitOf<D> U, QuantityValue Rep>
|
||||
template<Dimension D, UnitOf<D> U, Representation Rep>
|
||||
class quantity;
|
||||
|
||||
template<Dimension D, UnitOf<D> U>
|
||||
@ -102,7 +102,7 @@ struct reference {
|
||||
template<Reference R2>
|
||||
[[nodiscard]] friend constexpr reference_divide<reference, R2> operator/(reference, R2) { return {}; }
|
||||
|
||||
template<QuantityValue Rep>
|
||||
template<Representation Rep>
|
||||
[[nodiscard]] friend constexpr Quantity auto operator*(const Rep& lhs, reference)
|
||||
{
|
||||
return quantity<D, U, Rep>(lhs);
|
||||
|
@ -47,7 +47,7 @@ struct petabit_per_second : deduced_unit<petabit_per_second, dim_bitrate, petabi
|
||||
template<typename T>
|
||||
concept Bitrate = QuantityOf<T, dim_bitrate>;
|
||||
|
||||
template<UnitOf<dim_bitrate> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_bitrate> U, Representation Rep = double>
|
||||
using bitrate = quantity<dim_bitrate, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -57,7 +57,7 @@ struct dim_information : base_dimension<"information", bit> {};
|
||||
template<typename T>
|
||||
concept Information = QuantityOf<T, dim_information>;
|
||||
|
||||
template<UnitOf<dim_information> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_information> U, Representation Rep = double>
|
||||
using information = quantity<dim_information, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -34,7 +34,7 @@ struct gigabaud : prefixed_alias_unit<isq::si::gigahertz, isq::si::giga, baud> {
|
||||
struct terabaud : prefixed_alias_unit<isq::si::terahertz, isq::si::tera, baud> {};
|
||||
struct petabaud : prefixed_alias_unit<isq::si::petahertz, isq::si::peta, baud> {};
|
||||
|
||||
template<UnitOf<isq::si::dim_frequency> U, QuantityValue Rep = double>
|
||||
template<UnitOf<isq::si::dim_frequency> U, Representation Rep = double>
|
||||
using symbolrate = quantity<isq::si::dim_frequency, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -29,35 +29,35 @@
|
||||
namespace units::isq::natural {
|
||||
|
||||
struct dim_length : isq::dim_length<inverted_gigaelectronvolt> {};
|
||||
template<UnitOf<dim_length> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_length> U, Representation Rep = double>
|
||||
using length = quantity<dim_length, U, Rep>;
|
||||
|
||||
struct dim_time : isq::dim_time<inverted_gigaelectronvolt> {};
|
||||
template<UnitOf<dim_time> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_time> U, Representation Rep = double>
|
||||
using time = quantity<dim_time, U, Rep>;
|
||||
|
||||
struct dim_mass : isq::dim_mass<gigaelectronvolt> {};
|
||||
template<UnitOf<dim_mass> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_mass> U, Representation Rep = double>
|
||||
using mass = quantity<dim_mass, U, Rep>;
|
||||
|
||||
struct dim_speed : isq::dim_speed<dim_speed, one, dim_length, dim_time> {};
|
||||
template<UnitOf<dim_speed> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_speed> U, Representation Rep = double>
|
||||
using speed = quantity<dim_speed, U, Rep>;
|
||||
|
||||
struct dim_acceleration : isq::dim_acceleration<dim_acceleration, gigaelectronvolt, dim_length, dim_time> {};
|
||||
template<UnitOf<dim_acceleration> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_acceleration> U, Representation Rep = double>
|
||||
using acceleration = quantity<dim_acceleration, U, Rep>;
|
||||
|
||||
struct dim_force : isq::dim_force<dim_force, square_gigaelectronvolt, dim_mass, dim_acceleration> {};
|
||||
template<UnitOf<dim_force> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_force> U, Representation Rep = double>
|
||||
using force = quantity<dim_force, U, Rep>;
|
||||
|
||||
struct dim_momentum : isq::dim_momentum<dim_momentum, gigaelectronvolt, dim_mass, dim_speed> {};
|
||||
template<UnitOf<dim_momentum> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_momentum> U, Representation Rep = double>
|
||||
using momentum = quantity<dim_momentum, U, Rep>;
|
||||
|
||||
struct dim_energy : isq::dim_energy<dim_energy, gigaelectronvolt, dim_force, dim_length> {};
|
||||
template<UnitOf<dim_force> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_force> U, Representation Rep = double>
|
||||
using energy = quantity<dim_force, U, Rep>;
|
||||
|
||||
// Typical UDLs will not work here as the same units are reused by many quantities.
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
namespace units::isq::natural {
|
||||
|
||||
template<QuantityValue Rep = double>
|
||||
template<Representation Rep = double>
|
||||
inline constexpr auto speed_of_light = speed<one, Rep>(1);
|
||||
|
||||
} // namespace units::isq::natural
|
||||
|
@ -31,7 +31,7 @@ namespace units::isq::si::cgs {
|
||||
struct gal : named_unit<gal, "Gal", si::prefix> {};
|
||||
struct dim_acceleration : isq::dim_acceleration<dim_acceleration, gal, dim_length, dim_time> {};
|
||||
|
||||
template<UnitOf<dim_acceleration> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_acceleration> U, Representation Rep = double>
|
||||
using acceleration = quantity<dim_acceleration, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -32,7 +32,7 @@ using si::square_centimetre;
|
||||
|
||||
struct dim_area : isq::dim_area<dim_area, square_centimetre, dim_length> {};
|
||||
|
||||
template<UnitOf<dim_area> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_area> U, Representation Rep = double>
|
||||
using area = quantity<dim_area, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -33,7 +33,7 @@ struct erg : named_unit<erg, "erg", si::prefix> {};
|
||||
|
||||
struct dim_energy : isq::dim_energy<dim_energy, erg, dim_force, dim_length> {};
|
||||
|
||||
template<UnitOf<dim_energy> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_energy> U, Representation Rep = double>
|
||||
using energy = quantity<dim_energy, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -34,7 +34,7 @@ struct dyne : named_unit<dyne, "dyn", si::prefix> {};
|
||||
|
||||
struct dim_force : isq::dim_force<dim_force, dyne, dim_mass, dim_acceleration> {};
|
||||
|
||||
template<UnitOf<dim_force> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_force> U, Representation Rep = double>
|
||||
using force = quantity<dim_force, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -31,7 +31,7 @@ using si::centimetre;
|
||||
|
||||
struct dim_length : isq::dim_length<centimetre> {};
|
||||
|
||||
template<UnitOf<dim_length> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_length> U, Representation Rep = double>
|
||||
using length = quantity<dim_length, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -31,7 +31,7 @@ using si::gram;
|
||||
|
||||
struct dim_mass : isq::dim_mass<gram> {};
|
||||
|
||||
template<UnitOf<dim_mass> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_mass> U, Representation Rep = double>
|
||||
using mass = quantity<dim_mass, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -33,7 +33,7 @@ struct erg_per_second : unit<erg_per_second> {};
|
||||
|
||||
struct dim_power : isq::dim_power<dim_power, erg_per_second, dim_energy, dim_time> {};
|
||||
|
||||
template<UnitOf<dim_power> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_power> U, Representation Rep = double>
|
||||
using power = quantity<dim_power, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -34,7 +34,7 @@ struct barye : named_unit<barye, "Ba", si::prefix> {};
|
||||
|
||||
struct dim_pressure : isq::dim_pressure<dim_pressure, barye, dim_force, dim_area> {};
|
||||
|
||||
template<UnitOf<dim_pressure> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_pressure> U, Representation Rep = double>
|
||||
using pressure = quantity<dim_pressure, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -32,7 +32,7 @@ namespace units::isq::si::cgs {
|
||||
struct centimetre_per_second : unit<centimetre_per_second> {};
|
||||
struct dim_speed : isq::dim_speed<dim_speed, centimetre_per_second, dim_length, dim_time> {};
|
||||
|
||||
template<UnitOf<dim_speed> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_speed> U, Representation Rep = double>
|
||||
using speed = quantity<dim_speed, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -31,7 +31,7 @@ namespace units::isq::si::fps {
|
||||
struct foot_per_second_sq : unit<foot_per_second_sq> {};
|
||||
struct dim_acceleration : isq::dim_acceleration<dim_acceleration, foot_per_second_sq, dim_length, dim_time> {};
|
||||
|
||||
template<UnitOf<dim_acceleration> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_acceleration> U, Representation Rep = double>
|
||||
using acceleration = quantity<dim_acceleration, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -32,7 +32,7 @@ struct square_foot : unit<square_foot> {};
|
||||
struct dim_area : isq::dim_area<dim_area, square_foot, dim_length> {};
|
||||
|
||||
|
||||
template<UnitOf<dim_area> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_area> U, Representation Rep = double>
|
||||
using area = quantity<dim_area, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -33,7 +33,7 @@ struct pound_per_foot_cub : unit<pound_per_foot_cub> {};
|
||||
|
||||
struct dim_density : isq::dim_density<dim_density, pound_per_foot_cub, dim_mass, dim_length> {};
|
||||
|
||||
template<UnitOf<dim_density> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_density> U, Representation Rep = double>
|
||||
using density = quantity<dim_density, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -39,7 +39,7 @@ struct foot_pound_force : noble_deduced_unit<foot_pound_force, dim_energy, pound
|
||||
|
||||
|
||||
|
||||
template<UnitOf<dim_energy> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_energy> U, Representation Rep = double>
|
||||
using energy = quantity<dim_energy, U, Rep>;
|
||||
|
||||
|
||||
|
@ -43,7 +43,7 @@ struct kip : alias_unit<kilopound_force, "klbf", no_prefix> {};
|
||||
|
||||
struct dim_force : isq::dim_force<dim_force, poundal, dim_mass, dim_acceleration> {};
|
||||
|
||||
template<UnitOf<dim_force> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_force> U, Representation Rep = double>
|
||||
using force = quantity<dim_force, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -51,7 +51,7 @@ struct nautical_mile : named_scaled_unit<nautical_mile, "mi(naut)", no_prefix, r
|
||||
|
||||
struct dim_length : isq::dim_length<foot> {};
|
||||
|
||||
template<UnitOf<dim_length> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_length> U, Representation Rep = double>
|
||||
using length = quantity<dim_length, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -32,7 +32,7 @@ struct pound : named_scaled_unit<pound, "lb", no_prefix, ratio(45'359'237, 100'0
|
||||
|
||||
struct dim_mass : isq::dim_mass<pound> {};
|
||||
|
||||
template<UnitOf<dim_mass> U, QuantityValue Rep = double>
|
||||
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>{};
|
||||
|
@ -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> {};
|
||||
|
||||
template<UnitOf<dim_power> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_power> U, Representation Rep = double>
|
||||
using power = quantity<dim_power, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -34,7 +34,7 @@ struct poundal_per_foot_sq : unit<poundal_per_foot_sq> {};
|
||||
|
||||
struct dim_pressure : isq::dim_pressure<dim_pressure, poundal_per_foot_sq, dim_force, dim_area> {};
|
||||
|
||||
template<UnitOf<dim_pressure> U, QuantityValue Rep = double>
|
||||
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> {};
|
||||
|
@ -32,7 +32,7 @@ namespace units::isq::si::fps {
|
||||
struct foot_per_second : unit<foot_per_second> {};
|
||||
struct dim_speed : isq::dim_speed<dim_speed, foot_per_second, dim_length, dim_time> {};
|
||||
|
||||
template<UnitOf<dim_speed> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_speed> U, Representation Rep = double>
|
||||
using speed = quantity<dim_speed, U, Rep>;
|
||||
|
||||
struct mile_per_hour : deduced_unit<mile_per_hour, dim_speed, mile, hour>{};
|
||||
|
@ -33,7 +33,7 @@ struct dim_volume : isq::dim_volume<dim_volume, cubic_foot, dim_length> {};
|
||||
|
||||
struct cubic_yard : deduced_unit<cubic_yard, dim_volume, yard> {};
|
||||
|
||||
template<UnitOf<dim_volume> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_volume> U, Representation Rep = double>
|
||||
using volume = quantity<dim_volume, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -53,7 +53,7 @@ struct yottagray : prefixed_unit<yottagray, yotta, gray> {};
|
||||
|
||||
struct dim_absorbed_dose : isq::dim_absorbed_dose<dim_absorbed_dose, gray, dim_energy, dim_mass> {};
|
||||
|
||||
template<UnitOf<dim_absorbed_dose> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_absorbed_dose> U, Representation Rep = double>
|
||||
using absorbed_dose = quantity<dim_absorbed_dose, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -31,7 +31,7 @@ namespace units::isq::si {
|
||||
struct metre_per_second_sq : unit<metre_per_second_sq> {};
|
||||
struct dim_acceleration : isq::dim_acceleration<dim_acceleration, metre_per_second_sq, dim_length, dim_time> {};
|
||||
|
||||
template<UnitOf<dim_acceleration> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_acceleration> U, Representation Rep = double>
|
||||
using acceleration = quantity<dim_acceleration, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -33,7 +33,7 @@ struct mole : named_unit<mole, "mol", prefix> {};
|
||||
|
||||
struct dim_amount_of_substance : isq::dim_amount_of_substance<mole> {};
|
||||
|
||||
template<UnitOf<dim_amount_of_substance> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_amount_of_substance> U, Representation Rep = double>
|
||||
using amount_of_substance = quantity<dim_amount_of_substance, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -34,7 +34,7 @@ struct radian_per_second : named_unit<radian_per_second, basic_symbol_text{"ω",
|
||||
|
||||
struct dim_angular_velocity : isq::dim_angular_velocity<dim_angular_velocity, radian_per_second, dim_angle<>, dim_time> {};
|
||||
|
||||
template<UnitOf<dim_angular_velocity> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_angular_velocity> U, Representation Rep = double>
|
||||
using angular_velocity = quantity<dim_angular_velocity, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -54,7 +54,7 @@ struct square_yottametre : deduced_unit<square_yottametre, dim_area, yottametre>
|
||||
|
||||
struct hectare : alias_unit<square_hectometre, "ha", no_prefix> {};
|
||||
|
||||
template<UnitOf<dim_area> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_area> U, Representation Rep = double>
|
||||
using area = quantity<dim_area, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -54,7 +54,7 @@ struct yottafarad : prefixed_unit<yottafarad, yotta, farad> {};
|
||||
|
||||
struct dim_capacitance : isq::dim_capacitance<dim_capacitance, farad, dim_electric_charge, dim_voltage> {};
|
||||
|
||||
template<UnitOf<dim_capacitance> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_capacitance> U, Representation Rep = double>
|
||||
using capacitance = quantity<dim_capacitance, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -56,7 +56,7 @@ struct enzyme_unit : named_scaled_unit<enzyme_unit, "U", prefix, ratio(1, 60, -6
|
||||
|
||||
struct dim_catalytic_activity : isq::dim_catalytic_activity<dim_catalytic_activity, katal, dim_time, dim_amount_of_substance> {};
|
||||
|
||||
template<UnitOf<dim_catalytic_activity> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_catalytic_activity> U, Representation Rep = double>
|
||||
using catalytic_activity = quantity<dim_catalytic_activity, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -36,10 +36,10 @@ struct coulomb_per_metre_sq : unit<coulomb_per_metre_sq> {};
|
||||
struct dim_charge_density : isq::dim_charge_density<dim_charge_density, coulomb_per_metre_cub, dim_electric_charge, dim_length> {};
|
||||
struct dim_surface_charge_density : isq::dim_surface_charge_density<dim_surface_charge_density, coulomb_per_metre_sq, dim_electric_charge, dim_length> {};
|
||||
|
||||
template<UnitOf<dim_charge_density> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_charge_density> U, Representation Rep = double>
|
||||
using charge_density = quantity<dim_charge_density, U, Rep>;
|
||||
|
||||
template<UnitOf<dim_surface_charge_density> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_surface_charge_density> U, Representation Rep = double>
|
||||
using surface_charge_density = quantity<dim_surface_charge_density, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -32,7 +32,7 @@ namespace units::isq::si {
|
||||
struct mol_per_metre_cub : unit<mol_per_metre_cub> {};
|
||||
struct dim_concentration : isq::dim_concentration<dim_concentration, mol_per_metre_cub, dim_amount_of_substance, dim_length> {};
|
||||
|
||||
template<UnitOf<dim_concentration> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_concentration> U, Representation Rep = double>
|
||||
using concentration = quantity<dim_concentration, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -49,7 +49,7 @@ struct yottasiemens : prefixed_unit<yottasiemens, yotta, siemens> {};
|
||||
|
||||
struct dim_conductance : isq::dim_conductance<dim_conductance, siemens, dim_resistance> {};
|
||||
|
||||
template<UnitOf<dim_conductance> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_conductance> U, Representation Rep = double>
|
||||
using conductance = quantity<dim_conductance, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -32,31 +32,31 @@
|
||||
|
||||
namespace units::isq::si::si2019 {
|
||||
|
||||
template<QuantityValue Rep = double>
|
||||
template<Representation Rep = double>
|
||||
inline constexpr auto planck_constant = energy<joule, Rep>(6.62607015e-34) * time<second, Rep>(1);
|
||||
|
||||
template<QuantityValue Rep = double>
|
||||
template<Representation Rep = double>
|
||||
inline constexpr auto reduced_planck_constant = energy<gigaelectronvolt, Rep>(6.582119569e-10) * time<second, Rep>(1);
|
||||
|
||||
template<QuantityValue Rep = double>
|
||||
template<Representation Rep = double>
|
||||
inline constexpr auto elementary_charge = electric_charge<coulomb, Rep>(1.602176634e-19);
|
||||
|
||||
template<QuantityValue Rep = double>
|
||||
template<Representation Rep = double>
|
||||
inline constexpr auto boltzmann_constant = energy<joule, Rep>(1.380649e-23) / temperature<kelvin, Rep>(1);
|
||||
|
||||
template<QuantityValue Rep = double>
|
||||
template<Representation Rep = double>
|
||||
inline constexpr auto avogadro_constant = Rep(6.02214076e23) / substance<mole, Rep>(1);
|
||||
|
||||
template<QuantityValue Rep = double>
|
||||
template<Representation Rep = double>
|
||||
inline constexpr auto speed_of_light = speed<metre_per_second, Rep>(299'792'458);
|
||||
|
||||
template<QuantityValue Rep = double>
|
||||
template<Representation Rep = double>
|
||||
inline constexpr auto hyperfine_structure_transition_frequency = frequency<hertz, Rep>(9'192'631'770);
|
||||
|
||||
// template<QuantityValue Rep = double>
|
||||
// template<Representation Rep = double>
|
||||
// inline constexpr auto luminous_efficacy = 683_q_lm / 1_q_W;
|
||||
|
||||
template<QuantityValue Rep = double>
|
||||
template<Representation Rep = double>
|
||||
inline constexpr auto standard_gravity = acceleration<metre_per_second_sq, Rep>(9.80665);
|
||||
|
||||
} // namespace units::isq::si::si2019
|
||||
|
@ -34,7 +34,7 @@ struct ampere_per_metre_sq : unit<ampere_per_metre_sq> {};
|
||||
|
||||
struct dim_current_density : isq::dim_current_density<dim_current_density, ampere_per_metre_sq, dim_electric_current, dim_length> {};
|
||||
|
||||
template<UnitOf<dim_current_density> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_current_density> U, Representation Rep = double>
|
||||
using current_density = quantity<dim_current_density, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -34,7 +34,7 @@ struct kilogram_per_metre_cub : unit<kilogram_per_metre_cub> {};
|
||||
|
||||
struct dim_density : isq::dim_density<dim_density, kilogram_per_metre_cub, dim_mass, dim_length> {};
|
||||
|
||||
template<UnitOf<dim_density> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_density> U, Representation Rep = double>
|
||||
using density = quantity<dim_density, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -32,7 +32,7 @@ namespace units::isq::si {
|
||||
struct pascal_second : unit<pascal_second> {};
|
||||
struct dim_dynamic_viscosity : isq::dim_dynamic_viscosity<dim_dynamic_viscosity, pascal_second, dim_pressure, dim_time> {};
|
||||
|
||||
template<UnitOf<dim_dynamic_viscosity> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_dynamic_viscosity> U, Representation Rep = double>
|
||||
using dynamic_viscosity = quantity<dim_dynamic_viscosity, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -33,7 +33,7 @@ struct coulomb : named_unit<coulomb, "C", prefix> {};
|
||||
|
||||
struct dim_electric_charge : isq::dim_electric_charge<dim_electric_charge, coulomb, dim_time, dim_electric_current> {};
|
||||
|
||||
template<UnitOf<dim_electric_charge> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_electric_charge> U, Representation Rep = double>
|
||||
using electric_charge = quantity<dim_electric_charge, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -53,7 +53,7 @@ struct yottaampere : prefixed_unit<yottaampere, yotta, ampere> {};
|
||||
|
||||
struct dim_electric_current : isq::dim_electric_current<ampere> {};
|
||||
|
||||
template<UnitOf<dim_electric_current> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_electric_current> U, Representation Rep = double>
|
||||
using electric_current = quantity<dim_electric_current, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -31,7 +31,7 @@ namespace units::isq::si {
|
||||
struct volt_per_metre : unit<volt_per_metre> {};
|
||||
struct dim_electric_field_strength : isq::dim_electric_field_strength<dim_electric_field_strength, volt_per_metre, dim_voltage, dim_length> {};
|
||||
|
||||
template<UnitOf<dim_electric_field_strength> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_electric_field_strength> U, Representation Rep = double>
|
||||
using electric_field_strength = quantity<dim_electric_field_strength, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -52,7 +52,7 @@ struct gigaelectronvolt : prefixed_unit<gigaelectronvolt, giga, electronvolt> {}
|
||||
|
||||
struct dim_energy : isq::dim_energy<dim_energy, joule, dim_force, dim_length> {};
|
||||
|
||||
template<UnitOf<dim_energy> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_energy> U, Representation Rep = double>
|
||||
using energy = quantity<dim_energy, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -32,7 +32,7 @@ namespace units::isq::si {
|
||||
struct joule_per_metre_cub : unit<joule_per_metre_cub> {};
|
||||
struct dim_energy_density : isq::dim_energy_density<dim_energy_density, joule_per_metre_cub, dim_energy, dim_volume> {};
|
||||
|
||||
template<UnitOf<dim_energy_density> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_energy_density> U, Representation Rep = double>
|
||||
using energy_density = quantity<dim_energy_density, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -54,7 +54,7 @@ struct yottanewton : prefixed_unit<yottanewton, yotta, newton> {};
|
||||
|
||||
struct dim_force : isq::dim_force<dim_force, newton, dim_mass, dim_acceleration> {};
|
||||
|
||||
template<UnitOf<dim_force> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_force> U, Representation Rep = double>
|
||||
using force = quantity<dim_force, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -48,7 +48,7 @@ struct yottahertz : prefixed_unit<yottahertz, yotta, hertz> {};
|
||||
|
||||
struct dim_frequency : isq::dim_frequency<dim_frequency, hertz, dim_time> {};
|
||||
|
||||
template<UnitOf<dim_frequency> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_frequency> U, Representation Rep = double>
|
||||
using frequency = quantity<dim_frequency, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -39,13 +39,13 @@ struct dim_heat_capacity : isq::dim_heat_capacity<dim_heat_capacity, joule_per_k
|
||||
struct dim_specific_heat_capacity : isq::dim_specific_heat_capacity<dim_specific_heat_capacity, joule_per_kilogram_kelvin, dim_heat_capacity, dim_mass> {};
|
||||
struct dim_molar_heat_capacity : isq::dim_molar_heat_capacity<dim_molar_heat_capacity, joule_per_mole_kelvin, dim_heat_capacity, dim_amount_of_substance> {};
|
||||
|
||||
template<UnitOf<dim_heat_capacity> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_heat_capacity> U, Representation Rep = double>
|
||||
using heat_capacity = quantity<dim_heat_capacity, U, Rep>;
|
||||
|
||||
template<UnitOf<dim_specific_heat_capacity> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_specific_heat_capacity> U, Representation Rep = double>
|
||||
using specific_heat_capacity = quantity<dim_specific_heat_capacity, U, Rep>;
|
||||
|
||||
template<UnitOf<dim_molar_heat_capacity> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_molar_heat_capacity> U, Representation Rep = double>
|
||||
using molar_heat_capacity = quantity<dim_molar_heat_capacity, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -50,7 +50,7 @@ struct yottahenry : prefixed_unit<yottahenry, yotta, henry> {};
|
||||
|
||||
struct dim_inductance : isq::dim_inductance<dim_inductance, henry, dim_magnetic_flux, dim_electric_current> {};
|
||||
|
||||
template<UnitOf<dim_inductance> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_inductance> U, Representation Rep = double>
|
||||
using inductance = quantity<dim_inductance, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -55,7 +55,7 @@ struct astronomical_unit : named_scaled_unit<astronomical_unit, "au", no_prefix,
|
||||
|
||||
struct dim_length : isq::dim_length<metre> {};
|
||||
|
||||
template<UnitOf<dim_length> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_length> U, Representation Rep = double>
|
||||
using length = quantity<dim_length, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -32,7 +32,7 @@ namespace units::isq::si {
|
||||
struct candela_per_metre_sq : unit<candela_per_metre_sq> {};
|
||||
struct dim_luminance : isq::dim_luminance<dim_luminance, candela_per_metre_sq, dim_luminous_intensity, dim_length> {};
|
||||
|
||||
template<UnitOf<dim_luminance> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_luminance> U, Representation Rep = double>
|
||||
using luminance = quantity<dim_luminance, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -53,7 +53,7 @@ struct yottacandela : prefixed_unit<yottacandela, yotta, candela> {};
|
||||
|
||||
struct dim_luminous_intensity : isq::dim_luminous_intensity<candela> {};
|
||||
|
||||
template<UnitOf<dim_luminous_intensity> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_luminous_intensity> U, Representation Rep = double>
|
||||
using luminous_intensity = quantity<dim_luminous_intensity, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -50,7 +50,7 @@ struct yottaweber : prefixed_unit<yottaweber, yotta, weber> {};
|
||||
|
||||
struct dim_magnetic_flux : isq::dim_magnetic_flux<dim_magnetic_flux, weber, dim_magnetic_induction, dim_area> {};
|
||||
|
||||
template<UnitOf<dim_magnetic_flux> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_magnetic_flux> U, Representation Rep = double>
|
||||
using magnetic_flux = quantity<dim_magnetic_flux, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -54,7 +54,7 @@ struct gauss : named_scaled_unit<gauss, "G", prefix, ratio(1, 10'000), tesla> {}
|
||||
|
||||
struct dim_magnetic_induction : isq::dim_magnetic_induction<dim_magnetic_induction, tesla, dim_voltage, dim_time, dim_length> {};
|
||||
|
||||
template<UnitOf<dim_magnetic_induction> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_magnetic_induction> U, Representation Rep = double>
|
||||
using magnetic_induction = quantity<dim_magnetic_induction, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -77,7 +77,7 @@ struct dalton : named_scaled_unit<dalton, "Da", no_prefix, ratio(16'605'390'666'
|
||||
|
||||
struct dim_mass : isq::dim_mass<kilogram> {};
|
||||
|
||||
template<UnitOf<dim_mass> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_mass> U, Representation Rep = double>
|
||||
using mass = quantity<dim_mass, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -34,7 +34,7 @@ struct joule_per_mole : unit<joule_per_mole> {};
|
||||
|
||||
struct dim_molar_energy : isq::dim_molar_energy<dim_molar_energy, joule_per_mole, dim_energy, dim_amount_of_substance> {};
|
||||
|
||||
template<UnitOf<dim_molar_energy> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_molar_energy> U, Representation Rep = double>
|
||||
using molar_energy = quantity<dim_molar_energy, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -32,7 +32,7 @@ namespace units::isq::si {
|
||||
struct kilogram_metre_per_second : unit<kilogram_metre_per_second> {};
|
||||
struct dim_momentum : isq::dim_momentum<dim_momentum, kilogram_metre_per_second, dim_mass, dim_speed> {};
|
||||
|
||||
template<UnitOf<dim_momentum> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_momentum> U, Representation Rep = double>
|
||||
using momentum = quantity<dim_momentum, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -33,7 +33,7 @@ struct henry_per_metre : unit<henry_per_metre> {};
|
||||
|
||||
struct dim_permeability : isq::dim_permeability<dim_permeability, henry_per_metre, dim_inductance, dim_length> {};
|
||||
|
||||
template<UnitOf<dim_permeability> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_permeability> U, Representation Rep = double>
|
||||
using permeability = quantity<dim_permeability, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -33,7 +33,7 @@ struct farad_per_metre : unit<farad_per_metre> {};
|
||||
|
||||
struct dim_permittivity : isq::dim_permittivity<dim_permittivity, farad_per_metre, dim_capacitance, dim_length> {};
|
||||
|
||||
template<UnitOf<dim_permittivity> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_permittivity> U, Representation Rep = double>
|
||||
using permittivity = quantity<dim_permittivity, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -49,7 +49,7 @@ struct yottawatt : prefixed_unit<yottawatt, yotta, watt> {};
|
||||
|
||||
struct dim_power : isq::dim_power<dim_power, watt, dim_energy, dim_time> {};
|
||||
|
||||
template<UnitOf<dim_power> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_power> U, Representation Rep = double>
|
||||
using power = quantity<dim_power, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -54,7 +54,7 @@ struct yottapascal : prefixed_unit<yottapascal, yotta, pascal> {};
|
||||
|
||||
struct dim_pressure : isq::dim_pressure<dim_pressure, pascal, dim_force, dim_area> {};
|
||||
|
||||
template<UnitOf<dim_pressure> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_pressure> U, Representation Rep = double>
|
||||
using pressure = quantity<dim_pressure, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -52,7 +52,7 @@ struct yottabecquerel : prefixed_unit<yottabecquerel, yotta, becquerel> {};
|
||||
|
||||
struct dim_radioactivity : isq::dim_radioactivity<dim_radioactivity, becquerel, dim_time> {};
|
||||
|
||||
template<UnitOf<dim_radioactivity> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_radioactivity> U, Representation Rep = double>
|
||||
using radioactivity = quantity<dim_radioactivity, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -50,7 +50,7 @@ struct yottaohm : prefixed_unit<yottaohm, yotta, ohm> {};
|
||||
|
||||
struct dim_resistance : isq::dim_resistance<dim_resistance, ohm, dim_voltage, dim_electric_current> {};
|
||||
|
||||
template<UnitOf<dim_resistance> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_resistance> U, Representation Rep = double>
|
||||
using resistance = quantity<dim_resistance, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -34,7 +34,7 @@ struct dim_speed : isq::dim_speed<dim_speed, metre_per_second, dim_length, dim_t
|
||||
|
||||
struct kilometre_per_hour : deduced_unit<kilometre_per_hour, dim_speed, kilometre, hour> {};
|
||||
|
||||
template<UnitOf<dim_speed> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_speed> U, Representation Rep = double>
|
||||
using speed = quantity<dim_speed, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -32,7 +32,7 @@ struct newton_per_metre : unit<newton_per_metre> {};
|
||||
|
||||
struct dim_surface_tension : isq::dim_surface_tension<dim_surface_tension, newton_per_metre, dim_force, dim_length> {};
|
||||
|
||||
template<UnitOf<dim_surface_tension> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_surface_tension> U, Representation Rep = double>
|
||||
using surface_tension = quantity<dim_surface_tension, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -33,7 +33,7 @@ struct watt_per_metre_kelvin : unit<watt_per_metre_kelvin> {};
|
||||
|
||||
struct dim_thermal_conductivity : isq::dim_thermal_conductivity<dim_thermal_conductivity, watt_per_metre_kelvin, dim_power, dim_length, dim_thermodynamic_temperature> {};
|
||||
|
||||
template<UnitOf<dim_thermal_conductivity> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_thermal_conductivity> U, Representation Rep = double>
|
||||
using thermal_conductivity = quantity<dim_thermal_conductivity, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -32,7 +32,7 @@ struct kelvin : named_unit<kelvin, "K", no_prefix> {};
|
||||
|
||||
struct dim_thermodynamic_temperature : isq::dim_thermodynamic_temperature<kelvin> {};
|
||||
|
||||
template<UnitOf<dim_thermodynamic_temperature> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_thermodynamic_temperature> U, Representation Rep = double>
|
||||
using thermodynamic_temperature = quantity<dim_thermodynamic_temperature, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -44,7 +44,7 @@ struct day : named_scaled_unit<day, "d", no_prefix, ratio(24), hour> {};
|
||||
|
||||
struct dim_time : isq::dim_time<second> {};
|
||||
|
||||
template<UnitOf<dim_time> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_time> U, Representation Rep = double>
|
||||
using time = quantity<dim_time, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -34,7 +34,7 @@ struct newton_metre_per_radian : unit<newton_metre_per_radian> {};
|
||||
|
||||
struct dim_torque : isq::dim_torque<dim_torque, newton_metre_per_radian, dim_force, dim_length, dim_angle<>> {};
|
||||
|
||||
template<UnitOf<dim_torque> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_torque> U, Representation Rep = double>
|
||||
using torque = quantity<dim_torque, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -54,7 +54,7 @@ struct yottavolt : prefixed_unit<yottavolt, yotta, volt> {};
|
||||
|
||||
struct dim_voltage : isq::dim_voltage<dim_voltage, volt, dim_power, dim_electric_current> {};
|
||||
|
||||
template<UnitOf<dim_voltage> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_voltage> U, Representation Rep = double>
|
||||
using voltage = quantity<dim_voltage, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -74,7 +74,7 @@ struct exalitre : prefixed_unit<exalitre, exa, litre> {};
|
||||
struct zettalitre : prefixed_alias_unit<cubic_megametre, zetta, litre> {};
|
||||
struct yottalitre : prefixed_unit<yottalitre, yotta, litre> {};
|
||||
|
||||
template<UnitOf<dim_volume> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_volume> U, Representation Rep = double>
|
||||
using volume = quantity<dim_volume, U, Rep>;
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -93,14 +93,14 @@ static_assert(UnitOf<si::kilometre, si::dim_length>);
|
||||
static_assert(UnitOf<si::fps::mile, si::dim_length>);
|
||||
static_assert(!UnitOf<si::second, si::dim_length>);
|
||||
|
||||
// QuantityValue
|
||||
// Representation
|
||||
|
||||
static_assert(QuantityValue<int>);
|
||||
static_assert(QuantityValue<std::complex<double>>);
|
||||
static_assert(!QuantityValue<si::length<si::metre>>);
|
||||
static_assert(!QuantityValue<std::optional<si::length<si::metre>>>);
|
||||
static_assert(!QuantityValue<std::mutex>);
|
||||
static_assert(!QuantityValue<std::string>);
|
||||
static_assert(Representation<int>);
|
||||
static_assert(Representation<std::complex<double>>);
|
||||
static_assert(!Representation<si::length<si::metre>>);
|
||||
static_assert(!Representation<std::optional<si::length<si::metre>>>);
|
||||
static_assert(!Representation<std::mutex>);
|
||||
static_assert(!Representation<std::string>);
|
||||
|
||||
// Quantity
|
||||
|
||||
|
@ -29,10 +29,10 @@ namespace {
|
||||
* @brief Representation type meeting minimum requirements
|
||||
*
|
||||
* This type with a default Mode = 0 provides the minimum set of requirements to
|
||||
* satisfy @c QuantityValue concept which is used for quantity's representation type.
|
||||
* satisfy @c Representation concept which is used for quantity's representation type.
|
||||
*
|
||||
* In case of Mode != 0 only one of mandatory operation is removed which should
|
||||
* result in @c QuantityValue concept not being satisfied.
|
||||
* result in @c Representation concept not being satisfied.
|
||||
*
|
||||
* @tparam Mode a flag to disable specific type's operations
|
||||
*/
|
||||
@ -140,20 +140,20 @@ static_assert(!std::constructible_from<length<metre, int>, dimensionless<one, mi
|
||||
static_assert(!std::convertible_to<dimensionless<one, min_expl<>>, length<metre, int>>);
|
||||
|
||||
// all operations needed to satisfy concept
|
||||
static_assert(QuantityValue<min_expl<>>);
|
||||
static_assert(!QuantityValue<min_expl<1>>);
|
||||
static_assert(!QuantityValue<min_expl<2>>);
|
||||
static_assert(!QuantityValue<min_expl<3>>);
|
||||
static_assert(Representation<min_expl<>>);
|
||||
static_assert(!Representation<min_expl<1>>);
|
||||
static_assert(!Representation<min_expl<2>>);
|
||||
static_assert(!Representation<min_expl<3>>);
|
||||
#if !defined(UNITS_COMP_GCC) || UNITS_COMP_GCC > 10 || UNITS_COMP_GCC_MINOR > 1
|
||||
static_assert(!QuantityValue<min_expl<4>>);
|
||||
static_assert(!Representation<min_expl<4>>);
|
||||
#endif
|
||||
static_assert(!QuantityValue<min_expl<5>>);
|
||||
static_assert(!Representation<min_expl<5>>);
|
||||
#if !defined(UNITS_COMP_GCC) || UNITS_COMP_GCC > 10 || UNITS_COMP_GCC_MINOR > 1
|
||||
static_assert(!QuantityValue<min_expl<6>>);
|
||||
static_assert(!Representation<min_expl<6>>);
|
||||
#endif
|
||||
static_assert(!QuantityValue<min_expl<7>>);
|
||||
static_assert(!QuantityValue<min_expl<8>>);
|
||||
static_assert(!QuantityValue<min_expl<9>>);
|
||||
static_assert(!Representation<min_expl<7>>);
|
||||
static_assert(!Representation<min_expl<8>>);
|
||||
static_assert(!Representation<min_expl<9>>);
|
||||
|
||||
// quantity's operators should mirror the representation type capabilities
|
||||
template<typename Rep>
|
||||
|
@ -62,8 +62,8 @@ namespace {
|
||||
using namespace units;
|
||||
using namespace units::isq::si;
|
||||
|
||||
static_assert(QuantityValue<min_impl<int>>);
|
||||
static_assert(QuantityValue<min_impl<double>>);
|
||||
static_assert(Representation<min_impl<int>>);
|
||||
static_assert(Representation<min_impl<double>>);
|
||||
|
||||
// construction from a value
|
||||
static_assert(std::constructible_from<length<metre, min_impl<int>>, min_impl<int>>);
|
||||
|
@ -36,14 +36,14 @@ using namespace units::isq::si;
|
||||
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>> {};
|
||||
|
||||
template<UnitOf<dim_power_spectral_density> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_power_spectral_density> U, Representation Rep = double>
|
||||
using power_spectral_density = quantity<dim_power_spectral_density, U, Rep>;
|
||||
|
||||
// amplitude spectral density
|
||||
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>> {};
|
||||
|
||||
template<UnitOf<dim_amplitude_spectral_density> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_amplitude_spectral_density> U, Representation Rep = double>
|
||||
using amplitude_spectral_density = quantity<dim_amplitude_spectral_density, U, Rep>;
|
||||
|
||||
}
|
||||
|
@ -58,17 +58,17 @@ struct time_kind : kind<time_kind, dim_time> {};
|
||||
|
||||
struct cgs_width_kind : kind<cgs_width_kind, cgs::dim_length> {};
|
||||
|
||||
template <Unit U, QuantityValue Rep = double> using radius = quantity_kind<radius_kind, U, Rep>;
|
||||
template <Unit U, QuantityValue Rep = double> using width = quantity_kind<width_kind, U, Rep>;
|
||||
template <Unit U, QuantityValue Rep = double> using height = quantity_kind<height_kind, U, Rep>;
|
||||
template <Unit U, Representation Rep = double> using radius = quantity_kind<radius_kind, U, Rep>;
|
||||
template <Unit U, Representation Rep = double> using width = quantity_kind<width_kind, U, Rep>;
|
||||
template <Unit U, Representation Rep = double> using height = quantity_kind<height_kind, U, Rep>;
|
||||
|
||||
template <Unit U, QuantityValue Rep = double> using horizontal_area = quantity_kind<horizontal_area_kind, U, Rep>;
|
||||
template <Unit U, QuantityValue Rep = double> using rate_of_climb = quantity_kind<rate_of_climb_kind, U, Rep>;
|
||||
template <Unit U, Representation Rep = double> using horizontal_area = quantity_kind<horizontal_area_kind, U, Rep>;
|
||||
template <Unit U, Representation Rep = double> using rate_of_climb = quantity_kind<rate_of_climb_kind, U, Rep>;
|
||||
|
||||
template <Unit U = one, QuantityValue Rep = double> using apples = quantity_kind<apple, U, Rep>;
|
||||
template <Unit U = one, QuantityValue Rep = double> using oranges = quantity_kind<orange, U, Rep>;
|
||||
template <Unit U = one, Representation Rep = double> using apples = quantity_kind<apple, U, Rep>;
|
||||
template <Unit U = one, Representation Rep = double> using oranges = quantity_kind<orange, U, Rep>;
|
||||
|
||||
template <Unit U, QuantityValue Rep = double> using cgs_width = quantity_kind<cgs_width_kind, U, Rep>;
|
||||
template <Unit U, Representation Rep = double> using cgs_width = quantity_kind<cgs_width_kind, U, Rep>;
|
||||
|
||||
/////////////
|
||||
// concepts
|
||||
|
@ -64,21 +64,21 @@ struct nth_orange_kind : point_kind<nth_orange_kind, orange> {};
|
||||
struct time_kind : kind<time_kind, dim_time> {};
|
||||
struct time_point_kind : point_kind<time_point_kind, time_kind> {};
|
||||
|
||||
template <Unit U, QuantityValue Rep = double> using width = quantity_kind<width_kind, U, Rep>;
|
||||
template <Unit U, QuantityValue Rep = double> using height = quantity_kind<height_kind, U, Rep>;
|
||||
template <Unit U, QuantityValue Rep = double> using abscissa = quantity_point_kind<abscissa_kind, U, Rep>;
|
||||
template <Unit U, QuantityValue Rep = double> using ordinate = quantity_point_kind<ordinate_kind, U, Rep>;
|
||||
template <Unit U, Representation Rep = double> using width = quantity_kind<width_kind, U, Rep>;
|
||||
template <Unit U, Representation Rep = double> using height = quantity_kind<height_kind, U, Rep>;
|
||||
template <Unit U, Representation Rep = double> using abscissa = quantity_point_kind<abscissa_kind, U, Rep>;
|
||||
template <Unit U, Representation Rep = double> using ordinate = quantity_point_kind<ordinate_kind, U, Rep>;
|
||||
|
||||
template <Unit U, QuantityValue Rep = double> using distance = quantity_kind<distance_kind, U, Rep>;
|
||||
template <Unit U, QuantityValue Rep = double> using cgs_width = quantity_kind<cgs_width_kind, U, Rep>;
|
||||
template <Unit U, QuantityValue Rep = double> using cgs_height = quantity_kind<cgs_height_kind, U, Rep>;
|
||||
template <Unit U, QuantityValue Rep = double> using rate_of_climb = quantity_kind<rate_of_climb_kind, U, Rep>;
|
||||
template <Unit U, QuantityValue Rep = double> using altitude = quantity_point_kind<altitude_kind, U, Rep>;
|
||||
template <Unit U, Representation Rep = double> using distance = quantity_kind<distance_kind, U, Rep>;
|
||||
template <Unit U, Representation Rep = double> using cgs_width = quantity_kind<cgs_width_kind, U, Rep>;
|
||||
template <Unit U, Representation Rep = double> using cgs_height = quantity_kind<cgs_height_kind, U, Rep>;
|
||||
template <Unit U, Representation Rep = double> using rate_of_climb = quantity_kind<rate_of_climb_kind, U, Rep>;
|
||||
template <Unit U, Representation Rep = double> using altitude = quantity_point_kind<altitude_kind, U, Rep>;
|
||||
|
||||
template <Unit U = one, QuantityValue Rep = double> using apples = quantity_kind<apple, U, Rep>;
|
||||
template <Unit U = one, QuantityValue Rep = double> using oranges = quantity_kind<orange, U, Rep>;
|
||||
template <Unit U = one, QuantityValue Rep = double> using nth_apple = quantity_point_kind<nth_apple_kind, U, Rep>;
|
||||
template <Unit U = one, QuantityValue Rep = double> using nth_orange = quantity_point_kind<nth_orange_kind, U, Rep>;
|
||||
template <Unit U = one, Representation Rep = double> using apples = quantity_kind<apple, U, Rep>;
|
||||
template <Unit U = one, Representation Rep = double> using oranges = quantity_kind<orange, U, Rep>;
|
||||
template <Unit U = one, Representation Rep = double> using nth_apple = quantity_point_kind<nth_apple_kind, U, Rep>;
|
||||
template <Unit U = one, Representation Rep = double> using nth_orange = quantity_point_kind<nth_orange_kind, U, Rep>;
|
||||
|
||||
/////////////
|
||||
// concepts
|
||||
|
Reference in New Issue
Block a user