2020-09-08 18:40:46 +02:00
|
|
|
.. namespace:: units
|
|
|
|
|
|
2020-03-09 18:55:41 +01:00
|
|
|
Concepts
|
|
|
|
|
========
|
|
|
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
2020-03-19 14:44:56 +01:00
|
|
|
All names defined in this chapter reside in the :any:`units` namespace unless
|
|
|
|
|
specified otherwise.
|
2020-03-09 18:55:41 +01:00
|
|
|
|
2020-03-19 14:44:56 +01:00
|
|
|
.. concept:: template<typename T> PrefixFamily
|
2020-03-09 18:55:41 +01:00
|
|
|
|
2020-03-19 14:44:56 +01:00
|
|
|
A concept matching a prefix family. Satisfied by all types derived from :class:`prefix_family`.
|
2020-03-09 18:55:41 +01:00
|
|
|
|
|
|
|
|
.. concept:: template<typename T> Prefix
|
|
|
|
|
|
2020-03-19 14:44:56 +01:00
|
|
|
A concept matching a symbol prefix. Satisfied by all instantiations of :class:`prefix`.
|
2020-03-09 18:55:41 +01:00
|
|
|
|
2020-06-27 19:15:46 +02:00
|
|
|
.. concept:: template<ratio R> UnitRatio
|
2020-03-09 18:55:41 +01:00
|
|
|
|
2020-06-27 19:15:46 +02:00
|
|
|
Satisfied by all ratio values for which :expr:`R.num > 0` and :expr:`R.den > 0`.
|
2020-03-09 18:55:41 +01:00
|
|
|
|
|
|
|
|
.. concept:: template<typename T> BaseDimension
|
|
|
|
|
|
2020-03-19 14:44:56 +01:00
|
|
|
A concept matching all base dimensions in the library. Satisfied by all dimension types
|
|
|
|
|
derived from the instantiation of :class:`base_dimension`.
|
2020-03-09 18:55:41 +01:00
|
|
|
|
|
|
|
|
.. concept:: template<typename T> Exponent
|
|
|
|
|
|
2020-09-08 11:02:16 +02:00
|
|
|
A concept matching dimension's exponents. Satisfied by all instantiations of :class:`exponent`.
|
2020-03-09 18:55:41 +01:00
|
|
|
|
|
|
|
|
.. concept:: template<typename T> DerivedDimension
|
|
|
|
|
|
2020-03-19 14:44:56 +01:00
|
|
|
A concept matching all derived dimensions in the library. Satisfied by all dimension
|
2020-09-14 08:45:36 +02:00
|
|
|
types derived from the instantiation of ``detail::derived_dimension_base``.
|
2020-03-09 18:55:41 +01:00
|
|
|
|
|
|
|
|
.. concept:: template<typename T> Dimension
|
|
|
|
|
|
2020-03-19 14:44:56 +01:00
|
|
|
A concept matching all dimensions in the library. Satisfied by all dimension types for
|
|
|
|
|
which either :expr:`BaseDimension<T>` or :expr:`DerivedDimension<T>` is ``true``.
|
2020-03-09 18:55:41 +01:00
|
|
|
|
|
|
|
|
.. concept:: template<typename T> Unit
|
|
|
|
|
|
2020-03-19 14:44:56 +01:00
|
|
|
A concept matching all unit types in the library. Satisfied by all unit types derived
|
|
|
|
|
from the instantiation of :class:`scaled_unit`.
|
2020-03-09 18:55:41 +01:00
|
|
|
|
|
|
|
|
.. concept:: template<typename U, typename D> UnitOf
|
|
|
|
|
|
2020-03-19 14:44:56 +01:00
|
|
|
A concept matching only units of a specified dimension. Satisfied by all unit types that
|
|
|
|
|
satisfy :expr:`Unit<U>`, :expr:`Dimension<D>`, and for which :expr:`U::reference` and
|
2020-09-14 08:45:36 +02:00
|
|
|
``dimension_unit<D>::reference`` denote the same unit type.
|
2020-03-19 14:44:56 +01:00
|
|
|
|
|
|
|
|
:tparam U: Type to verify against concept constraints.
|
|
|
|
|
:tparam D: Dimension type to use for verification.
|
2020-03-09 18:55:41 +01:00
|
|
|
|
|
|
|
|
.. concept:: template<typename T> Quantity
|
|
|
|
|
|
2020-03-19 14:44:56 +01:00
|
|
|
A concept matching all quantities in the library. Satisfied by all instantiations of :class:`quantity`.
|
2020-03-09 18:55:41 +01:00
|
|
|
|
|
|
|
|
.. concept:: template<typename T> WrappedQuantity
|
|
|
|
|
|
2020-03-19 14:44:56 +01:00
|
|
|
A concept matching types that wrap quantity objects. Satisfied by all wrapper types that
|
|
|
|
|
satisfy :expr:`Quantity<typename T::value_type>` recursively
|
2020-09-14 08:45:36 +02:00
|
|
|
(i.e. ``std::optional<si::length<si::metre>>``).
|
2020-03-09 18:55:41 +01:00
|
|
|
|
2020-10-06 18:17:52 +02:00
|
|
|
.. concept:: template<typename T> QuantityValue
|
2020-03-09 18:55:41 +01:00
|
|
|
|
2020-10-06 19:50:00 +02:00
|
|
|
A concept matching types that can be used as a `Quantity` representation type. Satisfied
|
|
|
|
|
by types that match :expr:`(!Quantity<T>) && (!WrappedQuantity<T>) && std::regular<T>` and
|
|
|
|
|
satisfy one of the following:
|
|
|
|
|
|
|
|
|
|
- if :expr:`common_type_with<T, std::intmax_t>` is ``true``, then :expr:`std::common_type_t<T, std::intmax_t>`
|
|
|
|
|
must at least provide binary multiplication and division operators,
|
|
|
|
|
- otherwise, :expr:`T::value_type` must be valid, :expr:`common_type_with<T::value_type, std::intmax_t>` be
|
|
|
|
|
``true``, and :expr:`std::common_type_t<T::value_type, std::intmax_t>` must at least provide binary
|
|
|
|
|
multiplication and division operators with itself and ``T``.
|
2020-09-08 18:43:00 +02:00
|
|
|
|
|
|
|
|
.. concept:: template<typename T> QuantityPoint
|
|
|
|
|
|
|
|
|
|
A concept matching all quantity points in the library. Satisfied by all instantiations of
|
|
|
|
|
:class:`quantity_point`.
|
2020-09-13 17:45:12 +02:00
|
|
|
|
2020-09-14 08:45:36 +02:00
|
|
|
.. concept:: template<typename Dim, template<typename...> typename DimTemplate> DimensionOfT
|
2020-09-13 17:45:12 +02:00
|
|
|
|
|
|
|
|
A concept matching all dimensions being the instantiations derived from the provided dimension
|
|
|
|
|
class template.
|
|
|
|
|
|
2020-09-14 08:45:36 +02:00
|
|
|
.. concept:: template<typename Q, template<typename...> typename DimTemplate> QuantityOfT
|
2020-09-13 17:45:12 +02:00
|
|
|
|
|
|
|
|
A concept matching all quantities with a dimension being the instantiation derived from
|
|
|
|
|
the provided dimension class template.
|
|
|
|
|
|
2020-09-14 08:45:36 +02:00
|
|
|
.. concept:: template<typename T, typename Dim> QuantityOf
|
2020-09-13 17:45:12 +02:00
|
|
|
|
|
|
|
|
A concept matching all quantities with a dimension being the instantiation derived from
|
|
|
|
|
the provided dimension type.
|