From 68bdc82955d731de7fa012d09e03dc495012542b Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Sun, 13 Sep 2020 17:45:12 +0200 Subject: [PATCH] docs: quantity_of concepts family documentation added --- docs/reference/core/concepts.rst | 15 +++++++++++++++ src/include/units/bits/quantity_of.h | 21 ++++++++++++++++++--- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/docs/reference/core/concepts.rst b/docs/reference/core/concepts.rst index 747f47c9..4cd36599 100644 --- a/docs/reference/core/concepts.rst +++ b/docs/reference/core/concepts.rst @@ -78,3 +78,18 @@ Concepts A concept matching all quantity points in the library. Satisfied by all instantiations of :class:`quantity_point`. + +.. concept:: template typename DimTemplate> concept DimensionOfT + + A concept matching all dimensions being the instantiations derived from the provided dimension + class template. + +.. concept:: template typename DimTemplate> concept QuantityOfT + + A concept matching all quantities with a dimension being the instantiation derived from + the provided dimension class template. + +.. concept:: template concept QuantityOf + + A concept matching all quantities with a dimension being the instantiation derived from + the provided dimension type. diff --git a/src/include/units/bits/quantity_of.h b/src/include/units/bits/quantity_of.h index a9d72217..16adc768 100644 --- a/src/include/units/bits/quantity_of.h +++ b/src/include/units/bits/quantity_of.h @@ -45,6 +45,12 @@ concept EquivalentUnknownDimensionOfT = Dimension && is_derived_from_specia #endif +/** + * @brief A concept matching all dimensions matching provided dimension class template + * + * Satisfied by all dimensions being the instantiations derived from the provided dimension + * class template. + */ template typename DimTemplate> concept DimensionOfT = Dimension && (is_derived_from_specialization_of #if DOWNCAST_MODE == 0 @@ -52,13 +58,22 @@ concept DimensionOfT = Dimension && (is_derived_from_specialization_of typename DimTemplate> concept QuantityOfT = Quantity && DimensionOfT; -// QuantityOf +/** + * @brief A concept matching all quantities with provided dimension + * + * Satisfied by all quantities with a dimension being the instantiation derived from + * the provided dimension type. + */ template concept QuantityOf = Quantity && Dimension && equivalent; - } // namespace units