From c3d5fc6dbbb6aa260368003ef329a04485643343 Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Tue, 28 Apr 2026 21:10:01 +0200 Subject: [PATCH] docs: `non_negative` declarations added to `quantity_spec` in docs Co-authored-by: Copilot --- docs/blog/posts/isq-part-4-implementing-isq.md | 2 +- .../framework_basics/design_overview.md | 12 ++++++------ .../framework_basics/systems_of_quantities.md | 6 +++--- docs/users_guide/systems/isq.md | 14 +++++++------- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/docs/blog/posts/isq-part-4-implementing-isq.md b/docs/blog/posts/isq-part-4-implementing-isq.md index aa879f895..d1cfce455 100644 --- a/docs/blog/posts/isq-part-4-implementing-isq.md +++ b/docs/blog/posts/isq-part-4-implementing-isq.md @@ -63,7 +63,7 @@ This is how we can model it in C++: ```cpp inline constexpr struct dim_length final : base_dimension<"L"> {} dim_length; -inline constexpr struct length final : quantity_spec {} length; +inline constexpr struct length final : quantity_spec {} length; inline constexpr struct width final : quantity_spec {} width; inline constexpr auto breadth = width; inline constexpr struct height final : quantity_spec {} height; diff --git a/docs/users_guide/framework_basics/design_overview.md b/docs/users_guide/framework_basics/design_overview.md index d92a2c98b..8a651aac2 100644 --- a/docs/users_guide/framework_basics/design_overview.md +++ b/docs/users_guide/framework_basics/design_overview.md @@ -74,8 +74,8 @@ provided in the [quantity specification](../../reference/glossary.md#quantity_sp === "C++23" ```cpp - inline constexpr struct length final : quantity_spec {} length; - inline constexpr struct time final : quantity_spec {} time; + inline constexpr struct length final : quantity_spec {} length; + inline constexpr struct time final : quantity_spec {} time; inline constexpr struct speed final : quantity_spec {} speed; static_assert(speed.dimension == dim_length / dim_time); @@ -84,8 +84,8 @@ provided in the [quantity specification](../../reference/glossary.md#quantity_sp === "C++20" ```cpp - inline constexpr struct length final : quantity_spec {} length; - inline constexpr struct time final : quantity_spec {} time; + inline constexpr struct length final : quantity_spec {} length; + inline constexpr struct time final : quantity_spec {} time; inline constexpr struct speed final : quantity_spec {} speed; static_assert(speed.dimension == dim_length / dim_time); @@ -94,8 +94,8 @@ provided in the [quantity specification](../../reference/glossary.md#quantity_sp === "Portable" ```cpp - QUANTITY_SPEC(length, dim_length); - QUANTITY_SPEC(time, dim_time); + QUANTITY_SPEC(length, dim_length, non_negative); + QUANTITY_SPEC(time, dim_time, non_negative); QUANTITY_SPEC(speed, length / time); static_assert(speed.dimension == dim_length / dim_time); diff --git a/docs/users_guide/framework_basics/systems_of_quantities.md b/docs/users_guide/framework_basics/systems_of_quantities.md index c26df0cbb..7cd204643 100644 --- a/docs/users_guide/framework_basics/systems_of_quantities.md +++ b/docs/users_guide/framework_basics/systems_of_quantities.md @@ -156,7 +156,7 @@ For example, here is how the above quantity kind tree can be modeled in the libr === "C++23" ```cpp - inline constexpr struct length final : quantity_spec {} length; + inline constexpr struct length final : quantity_spec {} length; inline constexpr struct width final : quantity_spec {} width; inline constexpr auto breadth = width; // V2 workaround: altitude/depth as children of length, height as child of altitude @@ -179,7 +179,7 @@ For example, here is how the above quantity kind tree can be modeled in the libr === "C++20" ```cpp - inline constexpr struct length final : quantity_spec {} length; + inline constexpr struct length final : quantity_spec {} length; inline constexpr struct width final : quantity_spec {} width; inline constexpr auto breadth = width; // V2 workaround: altitude/depth as children of length, height as child of altitude @@ -202,7 +202,7 @@ For example, here is how the above quantity kind tree can be modeled in the libr === "Portable" ```cpp - QUANTITY_SPEC(length, dim_length); + QUANTITY_SPEC(length, dim_length, non_negative); QUANTITY_SPEC(width, length); inline constexpr auto breadth = width; // V2 workaround: altitude/depth as children of length, height as child of altitude diff --git a/docs/users_guide/systems/isq.md b/docs/users_guide/systems/isq.md index c06f06621..f5e3622f4 100644 --- a/docs/users_guide/systems/isq.md +++ b/docs/users_guide/systems/isq.md @@ -65,13 +65,13 @@ For each base dimension, the ISQ defines corresponding base quantities: ```cpp namespace mp_units::isq { -inline constexpr struct length final : quantity_spec {} length; -inline constexpr struct mass final : quantity_spec {} mass; -inline constexpr struct time final : quantity_spec {} time; +inline constexpr struct length final : quantity_spec {} length; +inline constexpr struct mass final : quantity_spec {} mass; +inline constexpr struct time final : quantity_spec {} time; inline constexpr struct electric_current final : quantity_spec {} electric_current; -inline constexpr struct thermodynamic_temperature final : quantity_spec {} thermodynamic_temperature; -inline constexpr struct amount_of_substance final : quantity_spec {} amount_of_substance; -inline constexpr struct luminous_intensity final : quantity_spec {} luminous_intensity; +inline constexpr struct thermodynamic_temperature final : quantity_spec {} thermodynamic_temperature; +inline constexpr struct amount_of_substance final : quantity_spec {} amount_of_substance; +inline constexpr struct luminous_intensity final : quantity_spec {} luminous_intensity; } ``` @@ -151,7 +151,7 @@ flowchart TD In code: ```cpp -inline constexpr struct length final : quantity_spec {} length; +inline constexpr struct length final : quantity_spec {} length; inline constexpr struct width final : quantity_spec {} width; inline constexpr auto breadth = width; inline constexpr struct height final : quantity_spec {} height;