From 45013f675287c82c5519c4715a45bf4abefcb94b Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Thu, 5 Sep 2024 10:06:43 +0200 Subject: [PATCH] fix: `inline` restored for non-template `constexpr` global variables --- docs/blog/posts/2.1.0-released.md | 18 +- docs/blog/posts/2.2.0-released.md | 46 +- docs/index.md | 4 +- .../character_of_a_quantity.md | 12 +- docs/users_guide/framework_basics/concepts.md | 2 +- .../framework_basics/design_overview.md | 44 +- .../dimensionless_quantities.md | 28 +- .../faster_than_lightspeed_constants.md | 4 +- .../interface_introduction.md | 10 +- .../simple_and_typed_quantities.md | 8 +- .../framework_basics/systems_of_quantities.md | 76 +- .../framework_basics/systems_of_units.md | 22 +- .../framework_basics/text_output.md | 54 +- .../framework_basics/the_affine_space.md | 30 +- .../framework_basics/value_conversions.md | 34 +- .../interoperability_with_other_libraries.md | 4 +- .../use_cases/wide_compatibility.md | 8 +- example/currency.cpp | 18 +- example/include/geographic.h | 6 +- example/include/validated_type.h | 2 +- example/storage_tank.cpp | 4 +- example/unmanned_aerial_vehicle.cpp | 2 +- src/core/include/mp-units/bits/hacks.h | 2 +- src/core/include/mp-units/bits/text_tools.h | 4 +- src/core/include/mp-units/compat_macros.h | 8 +- .../include/mp-units/framework/dimension.h | 10 +- .../include/mp-units/framework/magnitude.h | 6 +- .../mp-units/framework/quantity_spec.h | 42 +- .../mp-units/framework/system_reference.h | 16 +- src/core/include/mp-units/framework/unit.h | 24 +- .../include/mp-units/framework/value_cast.h | 6 +- .../include/mp-units/systems/angular/units.h | 26 +- src/systems/include/mp-units/systems/cgs.h | 46 +- src/systems/include/mp-units/systems/hep.h | 96 +- src/systems/include/mp-units/systems/iau.h | 56 +- .../mp-units/systems/iec80000/quantities.h | 18 +- .../mp-units/systems/iec80000/unit_symbols.h | 124 +- .../include/mp-units/systems/iec80000/units.h | 10 +- .../include/mp-units/systems/imperial.h | 82 +- .../include/mp-units/systems/international.h | 78 +- .../mp-units/systems/isq/base_quantities.h | 16 +- .../mp-units/systems/isq/electromagnetism.h | 38 +- .../systems/isq/light_and_radiation.h | 4 +- .../include/mp-units/systems/isq/mechanics.h | 32 +- .../mp-units/systems/isq/si_quantities.h | 6 +- .../mp-units/systems/isq/space_and_time.h | 16 +- .../mp-units/systems/isq/thermodynamics.h | 18 +- .../include/mp-units/systems/isq_angle.h | 6 +- .../include/mp-units/systems/natural.h | 28 +- .../include/mp-units/systems/si/constants.h | 18 +- .../mp-units/systems/si/unit_symbols.h | 1486 ++++++++--------- .../include/mp-units/systems/si/units.h | 98 +- .../include/mp-units/systems/typographic.h | 8 +- src/systems/include/mp-units/systems/usc.h | 178 +- test/runtime/truncation_test.cpp | 4 +- test/static/concepts_test.cpp | 8 +- test/static/dimension_test.cpp | 44 +- test/static/magnitude_test.cpp | 6 +- test/static/quantity_point_test.cpp | 32 +- test/static/quantity_spec_test.cpp | 10 +- test/static/reference_test.cpp | 50 +- test/static/test_tools.h | 8 +- test/static/unit_test.cpp | 62 +- 63 files changed, 1634 insertions(+), 1632 deletions(-) diff --git a/docs/blog/posts/2.1.0-released.md b/docs/blog/posts/2.1.0-released.md index e8a675f06..3138e8339 100644 --- a/docs/blog/posts/2.1.0-released.md +++ b/docs/blog/posts/2.1.0-released.md @@ -49,19 +49,19 @@ As a side effect, we introduced a :boom: **breaking change** :boom:. We can't us hertz anymore: ```cpp -constexpr struct hertz : named_unit<"Hz", 1 / second, kind_of> {} hertz; +inline constexpr struct hertz : named_unit<"Hz", 1 / second, kind_of> {} hertz; ``` and have to type either: ```cpp -constexpr struct hertz : named_unit<"Hz", one / second, kind_of> {} hertz; +inline constexpr struct hertz : named_unit<"Hz", one / second, kind_of> {} hertz; ``` or ```cpp -constexpr struct hertz : named_unit<"Hz", inverse(second), kind_of> {} hertz; +inline constexpr struct hertz : named_unit<"Hz", inverse(second), kind_of> {} hertz; ``` To be consistent, we applied the same change to the dimensions and quantity @@ -70,13 +70,13 @@ specifications definitions. Now, to define a _frequency_ we have to type: === "C++23" ```cpp - constexpr struct frequency : quantity_spec {} frequency; + inline constexpr struct frequency : quantity_spec {} frequency; ``` === "C++20" ```cpp - constexpr struct frequency : quantity_spec {} frequency; + inline constexpr struct frequency : quantity_spec {} frequency; ``` === "Portable" @@ -145,11 +145,11 @@ If we derive from the same instantiation of `absolute_point_origin` we end up wi point origin. This change allows us to provide different names for the same temperature points: ```cpp -constexpr struct absolute_zero : absolute_point_origin {} absolute_zero; -constexpr struct zeroth_kelvin : decltype(absolute_zero) {} zeroth_kelvin; +inline constexpr struct absolute_zero : absolute_point_origin {} absolute_zero; +inline constexpr struct zeroth_kelvin : decltype(absolute_zero) {} zeroth_kelvin; -constexpr struct ice_point : relative_point_origin {} ice_point; -constexpr struct zeroth_degree_Celsius : decltype(ice_point) {} zeroth_degree_Celsius; +inline constexpr struct ice_point : relative_point_origin {} ice_point; +inline constexpr struct zeroth_degree_Celsius : decltype(ice_point) {} zeroth_degree_Celsius; ``` Please note that this is a :boom: **breaking change** :boom: as well. diff --git a/docs/blog/posts/2.2.0-released.md b/docs/blog/posts/2.2.0-released.md index 55b8edd49..451a1f53b 100644 --- a/docs/blog/posts/2.2.0-released.md +++ b/docs/blog/posts/2.2.0-released.md @@ -281,13 +281,13 @@ is why it was renamed to `symbol_text` (:boom: **breaking change** :boom:). === "Now" ```cpp - constexpr struct ohm final : named_unit {} ohm; + inline constexpr struct ohm final : named_unit {} ohm; ``` === "Before" ```cpp - constexpr struct ohm : named_unit {} ohm; + inline constexpr struct ohm : named_unit {} ohm; ``` !!! note @@ -295,7 +295,7 @@ is why it was renamed to `symbol_text` (:boom: **breaking change** :boom:). On C++20-compliant compilers it should be enough to type the following in the unit's definition: ```cpp - constexpr struct ohm final : named_unit<{u8"Ω", "ohm"}, volt / ampere> {} ohm; + inline constexpr struct ohm final : named_unit<{u8"Ω", "ohm"}, volt / ampere> {} ohm; ``` @@ -307,31 +307,31 @@ marked `final` (:boom: **breaking change** :boom:). === "Now" ```cpp - constexpr struct dim_length final : base_dimension<"L"> {} dim_length; - constexpr struct length final : quantity_spec {} length; + inline constexpr struct dim_length final : base_dimension<"L"> {} dim_length; + inline constexpr struct length final : quantity_spec {} length; - constexpr struct absolute_zero final : absolute_point_origin {} absolute_zero; - constexpr auto zeroth_kelvin = absolute_zero; - constexpr struct kelvin final : named_unit<"K", kind_of, zeroth_kelvin> {} kelvin; + inline constexpr struct absolute_zero final : absolute_point_origin {} absolute_zero; + inline constexpr auto zeroth_kelvin = absolute_zero; + inline constexpr struct kelvin final : named_unit<"K", kind_of, zeroth_kelvin> {} kelvin; - constexpr struct ice_point final : relative_point_origin}> {} ice_point; - constexpr auto zeroth_degree_Celsius = ice_point; - constexpr struct degree_Celsius final : named_unit {} degree_Celsius; + inline constexpr struct ice_point final : relative_point_origin}> {} ice_point; + inline constexpr auto zeroth_degree_Celsius = ice_point; + inline constexpr struct degree_Celsius final : named_unit {} degree_Celsius; ``` === "Before" ```cpp - constexpr struct dim_length : base_dimension<"L"> {} dim_length; - constexpr struct length : quantity_spec {} length; + inline constexpr struct dim_length : base_dimension<"L"> {} dim_length; + inline constexpr struct length : quantity_spec {} length; - constexpr struct absolute_zero : absolute_point_origin {} absolute_zero; - constexpr struct zeroth_kelvin : decltype(absolute_zero) {} zeroth_kelvin; - constexpr struct kelvin : named_unit<"K", kind_of, zeroth_kelvin> {} kelvin; + inline constexpr struct absolute_zero : absolute_point_origin {} absolute_zero; + inline constexpr struct zeroth_kelvin : decltype(absolute_zero) {} zeroth_kelvin; + inline constexpr struct kelvin : named_unit<"K", kind_of, zeroth_kelvin> {} kelvin; - constexpr struct ice_point : relative_point_origin}> {} ice_point; - constexpr struct zeroth_degree_Celsius : decltype(ice_point) {} zeroth_degree_Celsius; - constexpr struct degree_Celsius : named_unit {} degree_Celsius; + inline constexpr struct ice_point : relative_point_origin}> {} ice_point; + inline constexpr struct zeroth_degree_Celsius : decltype(ice_point) {} zeroth_degree_Celsius; + inline constexpr struct degree_Celsius : named_unit {} degree_Celsius; ``` Please also note, that the `absolute_point_origin` does not use CRTP idiom anymore (:boom: **breaking change** :boom:). @@ -509,13 +509,13 @@ conversion factor. Here is a comparison of the code with previous and current de === "Now" ```cpp - constexpr struct yard final : named_unit<"yd", mag_ratio<9'144, 10'000> * si::metre> {} yard; - constexpr struct foot final : named_unit<"ft", mag_ratio<1, 3> * yard> {} foot; + inline constexpr struct yard final : named_unit<"yd", mag_ratio<9'144, 10'000> * si::metre> {} yard; + inline constexpr struct foot final : named_unit<"ft", mag_ratio<1, 3> * yard> {} foot; ``` === "Before" ```cpp - constexpr struct yard : named_unit<"yd", mag * si::metre> {} yard; - constexpr struct foot : named_unit<"ft", mag * yard> {} foot; + inline constexpr struct yard : named_unit<"yd", mag * si::metre> {} yard; + inline constexpr struct foot : named_unit<"ft", mag * yard> {} foot; ``` diff --git a/docs/index.md b/docs/index.md index bfd1a2213..260316e17 100644 --- a/docs/index.md +++ b/docs/index.md @@ -33,7 +33,7 @@ The library source code is hosted on [GitHub](https://github.com/mpusz/mp-units) using namespace mp_units; - constexpr struct smoot final : named_unit<"smoot", mag<67> * usc::inch> {} smoot; + inline constexpr struct smoot final : named_unit<"smoot", mag<67> * usc::inch> {} smoot; int main() { @@ -53,7 +53,7 @@ The library source code is hosted on [GitHub](https://github.com/mpusz/mp-units) using namespace mp_units; - constexpr struct smoot final : named_unit<"smoot", mag<67> * usc::inch> {} smoot; + inline constexpr struct smoot final : named_unit<"smoot", mag<67> * usc::inch> {} smoot; int main() { diff --git a/docs/users_guide/framework_basics/character_of_a_quantity.md b/docs/users_guide/framework_basics/character_of_a_quantity.md index 3934cfda5..2ce5a1662 100644 --- a/docs/users_guide/framework_basics/character_of_a_quantity.md +++ b/docs/users_guide/framework_basics/character_of_a_quantity.md @@ -97,15 +97,15 @@ enumeration can be appended to the `quantity_spec` describing such a quantity ty === "C++23" ```cpp - constexpr struct position_vector final : quantity_spec {} position_vector; - constexpr struct displacement final : quantity_spec {} displacement; + inline constexpr struct position_vector final : quantity_spec {} position_vector; + inline constexpr struct displacement final : quantity_spec {} displacement; ``` === "C++20" ```cpp - constexpr struct position_vector final : quantity_spec {} position_vector; - constexpr struct displacement final : quantity_spec {} displacement; + inline constexpr struct position_vector final : quantity_spec {} position_vector; + inline constexpr struct displacement final : quantity_spec {} displacement; ``` === "Portable" @@ -126,13 +126,13 @@ character override is needed): === "C++23" ```cpp - constexpr struct velocity final : quantity_spec {} velocity; + inline constexpr struct velocity final : quantity_spec {} velocity; ``` === "C++20" ```cpp - constexpr struct velocity final : quantity_spec {} velocity; + inline constexpr struct velocity final : quantity_spec {} velocity; ``` === "Portable" diff --git a/docs/users_guide/framework_basics/concepts.md b/docs/users_guide/framework_basics/concepts.md index 1fce60160..33aa24c35 100644 --- a/docs/users_guide/framework_basics/concepts.md +++ b/docs/users_guide/framework_basics/concepts.md @@ -219,7 +219,7 @@ implicitly convertible from quantity specification `V`, which means that `V` mus However, if we define `mean_sea_level` in the following way: ```cpp - constexpr struct mean_sea_level final : absolute_point_origin {} mean_sea_level; + inline constexpr struct mean_sea_level final : absolute_point_origin {} mean_sea_level; ``` then it can't be used as a point origin for _points_ of `isq::length` or `isq::width` as none of them diff --git a/docs/users_guide/framework_basics/design_overview.md b/docs/users_guide/framework_basics/design_overview.md index c820c1a6a..a63a6846d 100644 --- a/docs/users_guide/framework_basics/design_overview.md +++ b/docs/users_guide/framework_basics/design_overview.md @@ -60,8 +60,8 @@ For example: the following way: ```cpp -constexpr struct dim_length final : base_dimension<"L"> {} dim_length; -constexpr struct dim_time final : base_dimension<"T"> {} dim_time; +inline constexpr struct dim_length final : base_dimension<"L"> {} dim_length; +inline constexpr struct dim_time final : base_dimension<"T"> {} dim_time; ``` [Derived dimensions](../../appendix/glossary.md#derived-dimension) are implicitly created @@ -71,9 +71,9 @@ provided in the [quantity specification](../../appendix/glossary.md#quantity_spe === "C++23" ```cpp - constexpr struct length final : quantity_spec {} length; - constexpr struct time final : quantity_spec {} time; - constexpr struct speed final : quantity_spec {} speed; + 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); ``` @@ -81,9 +81,9 @@ provided in the [quantity specification](../../appendix/glossary.md#quantity_spe === "C++20" ```cpp - constexpr struct length final : quantity_spec {} length; - constexpr struct time final : quantity_spec {} time; - constexpr struct speed final : quantity_spec {} speed; + 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); ``` @@ -183,17 +183,17 @@ Quantity specification can be defined by the user in one of the following ways: === "C++23" ```cpp - constexpr struct length final : quantity_spec {} length; - constexpr struct height final : quantity_spec {} height; - constexpr struct speed final : quantity_spec {} speed; + inline constexpr struct length final : quantity_spec {} length; + inline constexpr struct height final : quantity_spec {} height; + inline constexpr struct speed final : quantity_spec {} speed; ``` === "C++20" ```cpp - constexpr struct length final : quantity_spec {} length; - constexpr struct height final : quantity_spec {} height; - constexpr struct speed final : quantity_spec {} speed; + inline constexpr struct length final : quantity_spec {} length; + inline constexpr struct height final : quantity_spec {} height; + inline constexpr struct speed final : quantity_spec {} speed; ``` === "Portable" @@ -234,13 +234,13 @@ A unit can be defined by the user in one of the following ways: template struct kilo_ : prefixed_unit<"k", mag_power<10, 3>, U{}> {}; template constexpr kilo_ kilo; -constexpr struct second final : named_unit<"s", kind_of> {} second; -constexpr struct minute final : named_unit<"min", mag<60> * second> {} minute; -constexpr struct gram final : named_unit<"g", kind_of> {} gram; -constexpr auto kilogram = kilo; -constexpr struct newton final : named_unit<"N", kilogram * metre / square(second)> {} newton; +inline constexpr struct second final : named_unit<"s", kind_of> {} second; +inline constexpr struct minute final : named_unit<"min", mag<60> * second> {} minute; +inline constexpr struct gram final : named_unit<"g", kind_of> {} gram; +inline constexpr auto kilogram = kilo; +inline constexpr struct newton final : named_unit<"N", kilogram * metre / square(second)> {} newton; -constexpr struct speed_of_light_in_vacuum final : named_unit<"c", mag<299'792'458> * metre / second> {} speed_of_light_in_vacuum; +inline constexpr struct speed_of_light_in_vacuum final : named_unit<"c", mag<299'792'458> * metre / second> {} speed_of_light_in_vacuum; ``` The [unit equation](../../appendix/glossary.md#unit-equation) of `si::metre / si::second` results @@ -346,13 +346,13 @@ For example: - the absolute point origin can be defined in the following way: ```cpp - constexpr struct absolute_zero final : absolute_point_origin {} absolute_zero; + inline constexpr struct absolute_zero final : absolute_point_origin {} absolute_zero; ``` - the relative point origin can be defined in the following way: ```cpp - constexpr struct ice_point final : relative_point_origin> {} ice_point; + inline constexpr struct ice_point final : relative_point_origin> {} ice_point; ``` diff --git a/docs/users_guide/framework_basics/dimensionless_quantities.md b/docs/users_guide/framework_basics/dimensionless_quantities.md index 2c997222a..3cb3d089f 100644 --- a/docs/users_guide/framework_basics/dimensionless_quantities.md +++ b/docs/users_guide/framework_basics/dimensionless_quantities.md @@ -113,7 +113,7 @@ that uses a unit that is proportional to the ratio of kilometers per megaparsecs units of _length_: ```cpp -constexpr struct hubble_constant final : +inline constexpr struct hubble_constant final : named_unit<{u8"H₀", "H_0"}, mag_ratio<701, 10> * si::kilo / si::second / si::mega> {} hubble_constant; ``` @@ -158,10 +158,10 @@ Besides the unit `one`, there are a few other scaled units predefined in the lib with dimensionless quantities: ```cpp -constexpr struct percent final : named_unit<"%", mag_ratio<1, 100> * one> {} percent; -constexpr struct per_mille final : named_unit<{u8"‰", "%o"}, mag_ratio<1, 1000> * one> {} per_mille; -constexpr struct parts_per_million final : named_unit<"ppm", mag_ratio<1, 1'000'000> * one> {} parts_per_million; -constexpr auto ppm = parts_per_million; +inline constexpr struct percent final : named_unit<"%", mag_ratio<1, 100> * one> {} percent; +inline constexpr struct per_mille final : named_unit<{u8"‰", "%o"}, mag_ratio<1, 1000> * one> {} per_mille; +inline constexpr struct parts_per_million final : named_unit<"ppm", mag_ratio<1, 1'000'000> * one> {} parts_per_million; +inline constexpr auto ppm = parts_per_million; ``` ### Superpowers of the unit `one` @@ -271,17 +271,17 @@ to the quantity specification: === "C++23" ```cpp - constexpr struct angular_measure final : quantity_spec {} angular_measure; - constexpr struct solid_angular_measure final : quantity_spec(radius), is_kind> {} solid_angular_measure; - constexpr struct storage_capacity final : quantity_spec {} storage_capacity; + inline constexpr struct angular_measure final : quantity_spec {} angular_measure; + inline constexpr struct solid_angular_measure final : quantity_spec(radius), is_kind> {} solid_angular_measure; + inline constexpr struct storage_capacity final : quantity_spec {} storage_capacity; ``` === "C++20" ```cpp - constexpr struct angular_measure final : quantity_spec {} angular_measure; - constexpr struct solid_angular_measure final : quantity_spec(radius), is_kind> {} solid_angular_measure; - constexpr struct storage_capacity final : quantity_spec {} storage_capacity; + inline constexpr struct angular_measure final : quantity_spec {} angular_measure; + inline constexpr struct solid_angular_measure final : quantity_spec(radius), is_kind> {} solid_angular_measure; + inline constexpr struct storage_capacity final : quantity_spec {} storage_capacity; ``` === "Portable" @@ -296,9 +296,9 @@ With the above, we can constrain `radian`, `steradian`, and `bit` to be allowed specific quantity kinds only: ```cpp -constexpr struct radian final : named_unit<"rad", metre / metre, kind_of> {} radian; -constexpr struct steradian final : named_unit<"sr", square(metre) / square(metre), kind_of> {} steradian; -constexpr struct bit final : named_unit<"bit", one, kind_of> {} bit; +inline constexpr struct radian final : named_unit<"rad", metre / metre, kind_of> {} radian; +inline constexpr struct steradian final : named_unit<"sr", square(metre) / square(metre), kind_of> {} steradian; +inline constexpr struct bit final : named_unit<"bit", one, kind_of> {} bit; ``` but still allow the usage of `one` and its scaled versions for such quantities. diff --git a/docs/users_guide/framework_basics/faster_than_lightspeed_constants.md b/docs/users_guide/framework_basics/faster_than_lightspeed_constants.md index 5dd8c3eb4..cef490db0 100644 --- a/docs/users_guide/framework_basics/faster_than_lightspeed_constants.md +++ b/docs/users_guide/framework_basics/faster_than_lightspeed_constants.md @@ -39,12 +39,12 @@ namespace si { namespace si2019 { -constexpr struct speed_of_light_in_vacuum final : +inline constexpr struct speed_of_light_in_vacuum final : named_unit<"c", mag<299'792'458> * metre / second> {} speed_of_light_in_vacuum; } // namespace si2019 -constexpr struct magnetic_constant final : +inline constexpr struct magnetic_constant final : named_unit<{u8"μ₀", "u_0"}, mag<4> * mag_pi * mag_power<10, -7> * henry / metre> {} magnetic_constant; } // namespace mp_units::si diff --git a/docs/users_guide/framework_basics/interface_introduction.md b/docs/users_guide/framework_basics/interface_introduction.md index b7c6a2e54..31ebef0a9 100644 --- a/docs/users_guide/framework_basics/interface_introduction.md +++ b/docs/users_guide/framework_basics/interface_introduction.md @@ -6,8 +6,8 @@ The **mp-units** library decided to use a rather unusual pattern to define entit Here is how we define `metre` and `second` [SI](../../appendix/glossary.md#si) base units: ```cpp -constexpr struct metre final : named_unit<"m", kind_of> {} metre; -constexpr struct second final : named_unit<"s", kind_of> {} second; +inline constexpr struct metre final : named_unit<"m", kind_of> {} metre; +inline constexpr struct second final : named_unit<"s", kind_of> {} second; ``` Please note that the above reuses the same identifier for a type and its value. The rationale @@ -97,9 +97,9 @@ the value-based [unit equation](../../appendix/glossary.md#unit-equation) to a c definition: ```cpp -constexpr struct newton final : named_unit<"N", kilogram * metre / square(second)> {} newton; -constexpr struct pascal final : named_unit<"Pa", newton / square(metre)> {} pascal; -constexpr struct joule final : named_unit<"J", newton * metre> {} joule; +inline constexpr struct newton final : named_unit<"N", kilogram * metre / square(second)> {} newton; +inline constexpr struct pascal final : named_unit<"Pa", newton / square(metre)> {} pascal; +inline constexpr struct joule final : named_unit<"J", newton * metre> {} joule; ``` diff --git a/docs/users_guide/framework_basics/simple_and_typed_quantities.md b/docs/users_guide/framework_basics/simple_and_typed_quantities.md index 7dcf645dd..178c36e24 100644 --- a/docs/users_guide/framework_basics/simple_and_typed_quantities.md +++ b/docs/users_guide/framework_basics/simple_and_typed_quantities.md @@ -316,12 +316,12 @@ Let's see another example: using namespace mp_units; // add a custom quantity type of kind isq::length - constexpr struct horizontal_length final : + inline constexpr struct horizontal_length final : quantity_spec {} horizontal_length; // add a custom derived quantity type of kind isq::area // with a constrained quantity equation - constexpr struct horizontal_area final : + inline constexpr struct horizontal_area final : quantity_spec {} horizontal_area; class StorageTank { @@ -429,12 +429,12 @@ Let's see another example: using namespace mp_units; // add a custom quantity type of kind isq::length - constexpr struct horizontal_length final : + inline constexpr struct horizontal_length final : quantity_spec {} horizontal_length; // add a custom derived quantity type of kind isq::area // with a constrained quantity equation - constexpr struct horizontal_area final : + inline constexpr struct horizontal_area final : quantity_spec {} horizontal_area; class StorageTank { diff --git a/docs/users_guide/framework_basics/systems_of_quantities.md b/docs/users_guide/framework_basics/systems_of_quantities.md index fb9ee5475..438de2138 100644 --- a/docs/users_guide/framework_basics/systems_of_quantities.md +++ b/docs/users_guide/framework_basics/systems_of_quantities.md @@ -148,45 +148,45 @@ For example, here is how the above quantity kind tree can be modeled in the libr === "C++23" ```cpp - constexpr struct length final : quantity_spec {} length; - constexpr struct width final : quantity_spec {} width; - constexpr auto breadth = width; - constexpr struct height final : quantity_spec {} height; - constexpr auto depth = height; - constexpr auto altitude = height; - constexpr struct thickness final : quantity_spec {} thickness; - constexpr struct diameter final : quantity_spec {} diameter; - constexpr struct radius final : quantity_spec {} radius; - constexpr struct radius_of_curvature final : quantity_spec {} radius_of_curvature; - constexpr struct path_length final : quantity_spec {} path_length; - constexpr auto arc_length = path_length; - constexpr struct distance final : quantity_spec {} distance; - constexpr struct radial_distance final : quantity_spec {} radial_distance; - constexpr struct wavelength final : quantity_spec {} wavelength; - constexpr struct position_vector final : quantity_spec {} position_vector; - constexpr struct displacement final : quantity_spec {} displacement; + 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; + inline constexpr auto depth = height; + inline constexpr auto altitude = height; + inline constexpr struct thickness final : quantity_spec {} thickness; + inline constexpr struct diameter final : quantity_spec {} diameter; + inline constexpr struct radius final : quantity_spec {} radius; + inline constexpr struct radius_of_curvature final : quantity_spec {} radius_of_curvature; + inline constexpr struct path_length final : quantity_spec {} path_length; + inline constexpr auto arc_length = path_length; + inline constexpr struct distance final : quantity_spec {} distance; + inline constexpr struct radial_distance final : quantity_spec {} radial_distance; + inline constexpr struct wavelength final : quantity_spec {} wavelength; + inline constexpr struct position_vector final : quantity_spec {} position_vector; + inline constexpr struct displacement final : quantity_spec {} displacement; ``` === "C++20" ```cpp - constexpr struct length final : quantity_spec {} length; - constexpr struct width final : quantity_spec {} width; - constexpr auto breadth = width; - constexpr struct height final : quantity_spec {} height; - constexpr auto depth = height; - constexpr auto altitude = height; - constexpr struct thickness final : quantity_spec {} thickness; - constexpr struct diameter final : quantity_spec {} diameter; - constexpr struct radius final : quantity_spec {} radius; - constexpr struct radius_of_curvature final : quantity_spec {} radius_of_curvature; - constexpr struct path_length final : quantity_spec {} path_length; - constexpr auto arc_length = path_length; - constexpr struct distance final : quantity_spec {} distance; - constexpr struct radial_distance final : quantity_spec {} radial_distance; - constexpr struct wavelength final : quantity_spec {} wavelength; - constexpr struct position_vector final : quantity_spec {} position_vector; - constexpr struct displacement final : quantity_spec {} displacement; + 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; + inline constexpr auto depth = height; + inline constexpr auto altitude = height; + inline constexpr struct thickness final : quantity_spec {} thickness; + inline constexpr struct diameter final : quantity_spec {} diameter; + inline constexpr struct radius final : quantity_spec {} radius; + inline constexpr struct radius_of_curvature final : quantity_spec {} radius_of_curvature; + inline constexpr struct path_length final : quantity_spec {} path_length; + inline constexpr auto arc_length = path_length; + inline constexpr struct distance final : quantity_spec {} distance; + inline constexpr struct radial_distance final : quantity_spec {} radial_distance; + inline constexpr struct wavelength final : quantity_spec {} wavelength; + inline constexpr struct position_vector final : quantity_spec {} position_vector; + inline constexpr struct displacement final : quantity_spec {} displacement; ``` === "Portable" @@ -194,16 +194,16 @@ For example, here is how the above quantity kind tree can be modeled in the libr ```cpp QUANTITY_SPEC(length, dim_length); QUANTITY_SPEC(width, length); - constexpr auto breadth = width; + inline constexpr auto breadth = width; QUANTITY_SPEC(height, length); - constexpr auto depth = height; - constexpr auto altitude = height; + inline constexpr auto depth = height; + inline constexpr auto altitude = height; QUANTITY_SPEC(thickness, width); QUANTITY_SPEC(diameter, width); QUANTITY_SPEC(radius, width); QUANTITY_SPEC(radius_of_curvature, radius); QUANTITY_SPEC(path_length, length); - constexpr auto arc_length = path_length; + inline constexpr auto arc_length = path_length; QUANTITY_SPEC(distance, path_length); QUANTITY_SPEC(radial_distance, distance); QUANTITY_SPEC(wavelength, length); diff --git a/docs/users_guide/framework_basics/systems_of_units.md b/docs/users_guide/framework_basics/systems_of_units.md index a5573ddc0..39254c9b9 100644 --- a/docs/users_guide/framework_basics/systems_of_units.md +++ b/docs/users_guide/framework_basics/systems_of_units.md @@ -26,7 +26,7 @@ this is expressed by associating a quantity kind (that we discussed in detail in previous chapter) with a unit that is used to express it: ```cpp -constexpr struct metre final : named_unit<"m", kind_of> {} metre; +inline constexpr struct metre final : named_unit<"m", kind_of> {} metre; ``` !!! important @@ -67,7 +67,7 @@ of a specific predefined [unit equation](../../appendix/glossary.md#unit-equatio For example, a unit of _power_ quantity is defined in the library as: ```cpp -constexpr struct watt final : named_unit<"W", joule / second> {} watt; +inline constexpr struct watt final : named_unit<"W", joule / second> {} watt; ``` However, a _power_ quantity can be expressed in other units as well. For example, @@ -110,8 +110,8 @@ The library allows constraining such units to work only with quantities of a spe the following way: ```cpp -constexpr struct hertz final : named_unit<"Hz", one / second, kind_of> {} hertz; -constexpr struct becquerel final : named_unit<"Bq", one / second, kind_of> {} becquerel; +inline constexpr struct hertz final : named_unit<"Hz", one / second, kind_of> {} hertz; +inline constexpr struct becquerel final : named_unit<"Bq", one / second, kind_of> {} becquerel; ``` With the above, `hertz` can only be used with _frequencies_, while `becquerel` should only be used with @@ -145,7 +145,7 @@ and then a [PrefixableUnit](concepts.md#PrefixableUnit) can be prefixed in the f way: ```cpp -constexpr auto qm = quecto; +inline constexpr auto qm = quecto; ``` The usage of `mag_power` not only enables providing support for SI prefixes, but it can also @@ -168,25 +168,25 @@ be explicitly expressed with predefined SI prefixes. Those include units like mi electronvolt: ```cpp -constexpr struct minute final : named_unit<"min", mag<60> * si::second> {} minute; -constexpr struct hour final : named_unit<"h", mag<60> * minute> {} hour; -constexpr struct electronvolt final : named_unit<"eV", mag_ratio<1'602'176'634, 1'000'000'000> * mag_power<10, -19> * si::joule> {} electronvolt; +inline constexpr struct minute final : named_unit<"min", mag<60> * si::second> {} minute; +inline constexpr struct hour final : named_unit<"h", mag<60> * minute> {} hour; +inline constexpr struct electronvolt final : named_unit<"eV", mag_ratio<1'602'176'634, 1'000'000'000> * mag_power<10, -19> * si::joule> {} electronvolt; ``` Also, units of other [systems of units](../../appendix/glossary.md#system-of-units) are often defined in terms of scaled versions of the SI units. For example, the international yard is defined as: ```cpp -constexpr struct yard final : named_unit<"yd", mag_ratio<9'144, 10'000> * si::metre> {} yard; +inline constexpr struct yard final : named_unit<"yd", mag_ratio<9'144, 10'000> * si::metre> {} yard; ``` For some units, a magnitude might also be irrational. The best example here is a `degree` which is defined using a floating-point magnitude having a factor of the number π (Pi): ```cpp -constexpr struct mag_pi final : magnitude> {} mag_pi; +inline constexpr struct mag_pi final : magnitude> {} mag_pi; ``` ```cpp -constexpr struct degree final : named_unit<{u8"°", "deg"}, mag_pi / mag<180> * si::radian> {} degree; +inline constexpr struct degree final : named_unit<{u8"°", "deg"}, mag_pi / mag<180> * si::radian> {} degree; ``` diff --git a/docs/users_guide/framework_basics/text_output.md b/docs/users_guide/framework_basics/text_output.md index 0a7d79815..17a45a4f0 100644 --- a/docs/users_guide/framework_basics/text_output.md +++ b/docs/users_guide/framework_basics/text_output.md @@ -33,30 +33,30 @@ and units of derived quantities. === "Dimensions" ```cpp - constexpr struct dim_length final : base_dimension<"L"> {} dim_length; - constexpr struct dim_mass final : base_dimension<"M"> {} dim_mass; - constexpr struct dim_time final : base_dimension<"T"> {} dim_time; - constexpr struct dim_electric_current final : base_dimension<"I"> {} dim_electric_current; - constexpr struct dim_thermodynamic_temperature final : base_dimension<{u8"Θ", "O"}> {} dim_thermodynamic_temperature; - constexpr struct dim_amount_of_substance final : base_dimension<"N"> {} dim_amount_of_substance; - constexpr struct dim_luminous_intensity final : base_dimension<"J"> {} dim_luminous_intensity; + inline constexpr struct dim_length final : base_dimension<"L"> {} dim_length; + inline constexpr struct dim_mass final : base_dimension<"M"> {} dim_mass; + inline constexpr struct dim_time final : base_dimension<"T"> {} dim_time; + inline constexpr struct dim_electric_current final : base_dimension<"I"> {} dim_electric_current; + inline constexpr struct dim_thermodynamic_temperature final : base_dimension<{u8"Θ", "O"}> {} dim_thermodynamic_temperature; + inline constexpr struct dim_amount_of_substance final : base_dimension<"N"> {} dim_amount_of_substance; + inline constexpr struct dim_luminous_intensity final : base_dimension<"J"> {} dim_luminous_intensity; ``` === "Units" ```cpp - constexpr struct second final : named_unit<"s", kind_of> {} second; - constexpr struct metre final : named_unit<"m", kind_of> {} metre; - constexpr struct gram final : named_unit<"g", kind_of> {} gram; - constexpr auto kilogram = kilo; - - constexpr struct newton final : named_unit<"N", kilogram * metre / square(second)> {} newton; - constexpr struct joule final : named_unit<"J", newton * metre> {} joule; - constexpr struct watt final : named_unit<"W", joule / second> {} watt; - constexpr struct coulomb final : named_unit<"C", ampere * second> {} coulomb; - constexpr struct volt final : named_unit<"V", watt / ampere> {} volt; - constexpr struct farad final : named_unit<"F", coulomb / volt> {} farad; - constexpr struct ohm final : named_unit<{u8"Ω", "ohm"}, volt / ampere> {} ohm; + inline constexpr struct second final : named_unit<"s", kind_of> {} second; + inline constexpr struct metre final : named_unit<"m", kind_of> {} metre; + inline constexpr struct gram final : named_unit<"g", kind_of> {} gram; + inline constexpr auto kilogram = kilo; + + inline constexpr struct newton final : named_unit<"N", kilogram * metre / square(second)> {} newton; + inline constexpr struct joule final : named_unit<"J", newton * metre> {} joule; + inline constexpr struct watt final : named_unit<"W", joule / second> {} watt; + inline constexpr struct coulomb final : named_unit<"C", ampere * second> {} coulomb; + inline constexpr struct volt final : named_unit<"V", watt / ampere> {} volt; + inline constexpr struct farad final : named_unit<"F", coulomb / volt> {} farad; + inline constexpr struct ohm final : named_unit<{u8"Ω", "ohm"}, volt / ampere> {} ohm; ``` === "Prefixes" @@ -75,13 +75,13 @@ and units of derived quantities. === "Constants" ```cpp - constexpr struct hyperfine_structure_transition_frequency_of_cs final : named_unit<{u8"Δν_Cs", "dv_Cs"}, mag<9'192'631'770> * hertz> {} hyperfine_structure_transition_frequency_of_cs; - constexpr struct speed_of_light_in_vacuum final : named_unit<"c", mag<299'792'458> * metre / second> {} speed_of_light_in_vacuum; - constexpr struct planck_constant final : named_unit<"h", mag_ratio<662'607'015, 100'000'000> * mag_power<10, -34> * joule * second> {} planck_constant; - constexpr struct elementary_charge final : named_unit<"e", mag_ratio<1'602'176'634, 1'000'000'000> * mag_power<10, -19> * coulomb> {} elementary_charge; - constexpr struct boltzmann_constant final : named_unit<"k", mag_ratio<1'380'649, 1'000'000> * mag_power<10, -23> * joule / kelvin> {} boltzmann_constant; - constexpr struct avogadro_constant final : named_unit<"N_A", mag_ratio<602'214'076, 100'000'000> * mag_power<10, 23> / mole> {} avogadro_constant; - constexpr struct luminous_efficacy final : named_unit<"K_cd", mag<683> * lumen / watt> {} luminous_efficacy; + inline constexpr struct hyperfine_structure_transition_frequency_of_cs final : named_unit<{u8"Δν_Cs", "dv_Cs"}, mag<9'192'631'770> * hertz> {} hyperfine_structure_transition_frequency_of_cs; + inline constexpr struct speed_of_light_in_vacuum final : named_unit<"c", mag<299'792'458> * metre / second> {} speed_of_light_in_vacuum; + inline constexpr struct planck_constant final : named_unit<"h", mag_ratio<662'607'015, 100'000'000> * mag_power<10, -34> * joule * second> {} planck_constant; + inline constexpr struct elementary_charge final : named_unit<"e", mag_ratio<1'602'176'634, 1'000'000'000> * mag_power<10, -19> * coulomb> {} elementary_charge; + inline constexpr struct boltzmann_constant final : named_unit<"k", mag_ratio<1'380'649, 1'000'000> * mag_power<10, -23> * joule / kelvin> {} boltzmann_constant; + inline constexpr struct avogadro_constant final : named_unit<"N_A", mag_ratio<602'214'076, 100'000'000> * mag_power<10, 23> / mole> {} avogadro_constant; + inline constexpr struct luminous_efficacy final : named_unit<"K_cd", mag<683> * lumen / watt> {} luminous_efficacy; ``` !!! important @@ -105,7 +105,7 @@ and units of derived quantities. template name to initialize it with two symbols: ```cpp - constexpr struct ohm final : named_unit {} ohm; + inline constexpr struct ohm final : named_unit {} ohm; ``` diff --git a/docs/users_guide/framework_basics/the_affine_space.md b/docs/users_guide/framework_basics/the_affine_space.md index 7e760aca4..688c4379e 100644 --- a/docs/users_guide/framework_basics/the_affine_space.md +++ b/docs/users_guide/framework_basics/the_affine_space.md @@ -196,7 +196,7 @@ origin. ![affine_space_2](affine_space_2.svg){style="width:80%;display: block;margin: 0 auto;"} ```cpp -constexpr struct origin final : absolute_point_origin {} origin; +inline constexpr struct origin final : absolute_point_origin {} origin; // quantity_point qp1{100 * m}; // Compile-time error // quantity_point qp2{delta(120)}; // Compile-time error @@ -265,8 +265,8 @@ type and unit is being used: ![affine_space_3](affine_space_3.svg){style="width:80%;display: block;margin: 0 auto;"} ```cpp -constexpr struct origin1 final : absolute_point_origin {} origin1; -constexpr struct origin2 final : absolute_point_origin {} origin2; +inline constexpr struct origin1 final : absolute_point_origin {} origin1; +inline constexpr struct origin2 final : absolute_point_origin {} origin2; quantity_point qp1 = origin1 + 100 * m; quantity_point qp2 = origin2 + 120 * m; @@ -300,10 +300,10 @@ For such cases, relative point origins should be used: ![affine_space_4](affine_space_4.svg){style="width:80%;display: block;margin: 0 auto;"} ```cpp -constexpr struct A final : absolute_point_origin {} A; -constexpr struct B final : relative_point_origin {} B; -constexpr struct C final : relative_point_origin {} C; -constexpr struct D final : relative_point_origin {} D; +inline constexpr struct A final : absolute_point_origin {} A; +inline constexpr struct B final : relative_point_origin {} B; +inline constexpr struct C final : relative_point_origin {} C; +inline constexpr struct D final : relative_point_origin {} D; quantity_point qp1 = C + 100 * m; quantity_point qp2 = D + 120 * m; @@ -408,17 +408,17 @@ point origins for this purpose: ```cpp namespace si { -constexpr struct absolute_zero final : absolute_point_origin {} absolute_zero; -constexpr auto zeroth_kelvin = absolute_zero; +inline constexpr struct absolute_zero final : absolute_point_origin {} absolute_zero; +inline constexpr auto zeroth_kelvin = absolute_zero; -constexpr struct ice_point final : relative_point_origin>(273'150)}> {} ice_point; -constexpr auto zeroth_degree_Celsius = ice_point; +inline constexpr struct ice_point final : relative_point_origin>(273'150)}> {} ice_point; +inline constexpr auto zeroth_degree_Celsius = ice_point; } namespace usc { -constexpr struct zeroth_degree_Fahrenheit final : +inline constexpr struct zeroth_degree_Fahrenheit final : relative_point_origin * si::degree_Celsius>(-32)> {} zeroth_degree_Fahrenheit; } @@ -442,16 +442,16 @@ definitions: ```cpp namespace si { -constexpr struct kelvin final : +inline constexpr struct kelvin final : named_unit<"K", kind_of, zeroth_kelvin> {} kelvin; -constexpr struct degree_Celsius final : +inline constexpr struct degree_Celsius final : named_unit<{u8"℃", "`C"}, kelvin, zeroth_degree_Celsius> {} degree_Celsius; } namespace usc { -constexpr struct degree_Fahrenheit final : +inline constexpr struct degree_Fahrenheit final : named_unit<{u8"℉", "`F"}, mag_ratio<5, 9> * si::degree_Celsius, zeroth_degree_Fahrenheit> {} degree_Fahrenheit; diff --git a/docs/users_guide/framework_basics/value_conversions.md b/docs/users_guide/framework_basics/value_conversions.md index f22ad6aaa..1ec7e340a 100644 --- a/docs/users_guide/framework_basics/value_conversions.md +++ b/docs/users_guide/framework_basics/value_conversions.md @@ -85,16 +85,16 @@ the `value_cast(q)` which always returns the most precise result: === "C++23" ```cpp - constexpr struct dim_currency final : base_dimension<"$"> {} dim_currency; - constexpr struct currency final : quantity_spec {} currency; + inline constexpr struct dim_currency final : base_dimension<"$"> {} dim_currency; + inline constexpr struct currency final : quantity_spec {} currency; - constexpr struct us_dollar final : named_unit<"USD", kind_of> {} us_dollar; - constexpr struct scaled_us_dollar final : named_unit<"USD_s", mag_power<10, -8> * us_dollar> {} scaled_us_dollar; + inline constexpr struct us_dollar final : named_unit<"USD", kind_of> {} us_dollar; + inline constexpr struct scaled_us_dollar final : named_unit<"USD_s", mag_power<10, -8> * us_dollar> {} scaled_us_dollar; namespace unit_symbols { - constexpr auto USD = us_dollar; - constexpr auto USD_s = scaled_us_dollar; + inline constexpr auto USD = us_dollar; + inline constexpr auto USD_s = scaled_us_dollar; } // namespace unit_symbols @@ -105,16 +105,16 @@ the `value_cast(q)` which always returns the most precise result: === "C++20" ```cpp - constexpr struct dim_currency final : base_dimension<"$"> {} dim_currency; - constexpr struct currency final : quantity_spec {} currency; + inline constexpr struct dim_currency final : base_dimension<"$"> {} dim_currency; + inline constexpr struct currency final : quantity_spec {} currency; - constexpr struct us_dollar final : named_unit<"USD", kind_of> {} us_dollar; - constexpr struct scaled_us_dollar final : named_unit<"USD_s", mag_power<10, -8> * us_dollar> {} scaled_us_dollar; + inline constexpr struct us_dollar final : named_unit<"USD", kind_of> {} us_dollar; + inline constexpr struct scaled_us_dollar final : named_unit<"USD_s", mag_power<10, -8> * us_dollar> {} scaled_us_dollar; namespace unit_symbols { - constexpr auto USD = us_dollar; - constexpr auto USD_s = scaled_us_dollar; + inline constexpr auto USD = us_dollar; + inline constexpr auto USD_s = scaled_us_dollar; } // namespace unit_symbols @@ -125,16 +125,16 @@ the `value_cast(q)` which always returns the most precise result: === "Portable" ```cpp - constexpr struct dim_currency final : base_dimension<"$"> {} dim_currency; + inline constexpr struct dim_currency final : base_dimension<"$"> {} dim_currency; QUANTITY_SPEC(currency, dim_currency); - constexpr struct us_dollar final : named_unit<"USD", kind_of> {} us_dollar; - constexpr struct scaled_us_dollar final : named_unit<"USD_s", mag_power<10, -8> * us_dollar> {} scaled_us_dollar; + inline constexpr struct us_dollar final : named_unit<"USD", kind_of> {} us_dollar; + inline constexpr struct scaled_us_dollar final : named_unit<"USD_s", mag_power<10, -8> * us_dollar> {} scaled_us_dollar; namespace unit_symbols { - constexpr auto USD = us_dollar; - constexpr auto USD_s = scaled_us_dollar; + inline constexpr auto USD = us_dollar; + inline constexpr auto USD_s = scaled_us_dollar; } // namespace unit_symbols diff --git a/docs/users_guide/use_cases/interoperability_with_other_libraries.md b/docs/users_guide/use_cases/interoperability_with_other_libraries.md index b449b02fd..07da96af8 100644 --- a/docs/users_guide/use_cases/interoperability_with_other_libraries.md +++ b/docs/users_guide/use_cases/interoperability_with_other_libraries.md @@ -249,8 +249,8 @@ include the _mp-units/systems/si/chrono.h_ file to benefit from it. This file pr to the `std::chrono` abstractions: ```cpp - constexpr struct ts_origin final : relative_point_origin + 1 * h> {} ts_origin; - constexpr struct my_origin final : absolute_point_origin {} my_origin; + inline constexpr struct ts_origin final : relative_point_origin + 1 * h> {} ts_origin; + inline constexpr struct my_origin final : absolute_point_origin {} my_origin; quantity_point qp1 = sys_seconds{1s}; auto tp1 = to_chrono_time_point(qp1); // OK diff --git a/docs/users_guide/use_cases/wide_compatibility.md b/docs/users_guide/use_cases/wide_compatibility.md index 22c968c16..b3420d122 100644 --- a/docs/users_guide/use_cases/wide_compatibility.md +++ b/docs/users_guide/use_cases/wide_compatibility.md @@ -29,7 +29,7 @@ your code using **mp-units**: // ... - constexpr struct horizontal_length final : quantity_spec {} horizontal_length; + inline constexpr struct horizontal_length final : quantity_spec {} horizontal_length; // ... @@ -45,7 +45,7 @@ your code using **mp-units**: // ... - constexpr struct horizontal_length final : quantity_spec {} horizontal_length; + inline constexpr struct horizontal_length final : quantity_spec {} horizontal_length; // ... @@ -65,7 +65,7 @@ your code using **mp-units**: // ... - constexpr struct horizontal_length final : quantity_spec {} horizontal_length; + inline constexpr struct horizontal_length final : quantity_spec {} horizontal_length; // ... @@ -85,7 +85,7 @@ your code using **mp-units**: // ... - constexpr struct horizontal_length final : quantity_spec {} horizontal_length; + inline constexpr struct horizontal_length final : quantity_spec {} horizontal_length; // ... diff --git a/example/currency.cpp b/example/currency.cpp index fcc0e0d56..6f280659b 100644 --- a/example/currency.cpp +++ b/example/currency.cpp @@ -40,22 +40,22 @@ import mp_units.core; using namespace mp_units; // clang-format off -constexpr struct dim_currency final : base_dimension<"$"> {} dim_currency; +inline constexpr struct dim_currency final : base_dimension<"$"> {} dim_currency; QUANTITY_SPEC(currency, dim_currency); -constexpr struct euro final : named_unit<"EUR", kind_of> {} euro; -constexpr struct us_dollar final : named_unit<"USD", kind_of> {} us_dollar; -constexpr struct great_british_pound final : named_unit<"GBP", kind_of> {} great_british_pound; -constexpr struct japanese_jen final : named_unit<"JPY", kind_of> {} japanese_jen; +inline constexpr struct euro final : named_unit<"EUR", kind_of> {} euro; +inline constexpr struct us_dollar final : named_unit<"USD", kind_of> {} us_dollar; +inline constexpr struct great_british_pound final : named_unit<"GBP", kind_of> {} great_british_pound; +inline constexpr struct japanese_jen final : named_unit<"JPY", kind_of> {} japanese_jen; // clang-format on namespace unit_symbols { -constexpr auto EUR = euro; -constexpr auto USD = us_dollar; -constexpr auto GBP = great_british_pound; -constexpr auto JPY = japanese_jen; +inline constexpr auto EUR = euro; +inline constexpr auto USD = us_dollar; +inline constexpr auto GBP = great_british_pound; +inline constexpr auto JPY = japanese_jen; } // namespace unit_symbols diff --git a/example/include/geographic.h b/example/include/geographic.h index 9cbaaee1c..ba26b3f1a 100644 --- a/example/include/geographic.h +++ b/example/include/geographic.h @@ -44,7 +44,7 @@ import mp_units; namespace geographic { -constexpr struct mean_sea_level final : mp_units::absolute_point_origin { +inline constexpr struct mean_sea_level final : mp_units::absolute_point_origin { } mean_sea_level; using msl_altitude = mp_units::quantity_point; @@ -72,9 +72,9 @@ struct MP_UNITS_STD_FMT::formatter : namespace geographic { -constexpr struct equator final : mp_units::absolute_point_origin { +inline constexpr struct equator final : mp_units::absolute_point_origin { } equator; -constexpr struct prime_meridian final : mp_units::absolute_point_origin { +inline constexpr struct prime_meridian final : mp_units::absolute_point_origin { } prime_meridian; diff --git a/example/include/validated_type.h b/example/include/validated_type.h index 0150c1187..ec42f8938 100644 --- a/example/include/validated_type.h +++ b/example/include/validated_type.h @@ -40,7 +40,7 @@ import mp_units.core; #include #endif -constexpr struct validated_tag { +inline constexpr struct validated_tag { } validated; template Validator> diff --git a/example/storage_tank.cpp b/example/storage_tank.cpp index 2bb4f2370..86bc32ffa 100644 --- a/example/storage_tank.cpp +++ b/example/storage_tank.cpp @@ -58,8 +58,8 @@ QUANTITY_SPEC(horizontal_length, isq::length); // with a constrained quantity equation QUANTITY_SPEC(horizontal_area, isq::area, horizontal_length* isq::width); -constexpr auto g = 1 * si::standard_gravity; -constexpr auto air_density = isq::mass_density(1.225 * kg / m3); +inline constexpr auto g = 1 * si::standard_gravity; +inline constexpr auto air_density = isq::mass_density(1.225 * kg / m3); class StorageTank { quantity base_; diff --git a/example/unmanned_aerial_vehicle.cpp b/example/unmanned_aerial_vehicle.cpp index 2551110df..064e80553 100644 --- a/example/unmanned_aerial_vehicle.cpp +++ b/example/unmanned_aerial_vehicle.cpp @@ -119,7 +119,7 @@ hae_altitude to_hae(msl_altitude msl, position pos) // **** HAL **** // clang-format off -constexpr struct height_above_launch final : absolute_point_origin {} height_above_launch; +inline constexpr struct height_above_launch final : absolute_point_origin {} height_above_launch; // clang-format on using hal_altitude = quantity_point; diff --git a/src/core/include/mp-units/bits/hacks.h b/src/core/include/mp-units/bits/hacks.h index 2c66f2969..5030debb7 100644 --- a/src/core/include/mp-units/bits/hacks.h +++ b/src/core/include/mp-units/bits/hacks.h @@ -104,7 +104,7 @@ namespace std { struct from_range_t { explicit from_range_t() = default; }; -constexpr from_range_t from_range{}; +inline constexpr from_range_t from_range{}; } // namespace std diff --git a/src/core/include/mp-units/bits/text_tools.h b/src/core/include/mp-units/bits/text_tools.h index 123ad858b..dc5bfed3f 100644 --- a/src/core/include/mp-units/bits/text_tools.h +++ b/src/core/include/mp-units/bits/text_tools.h @@ -63,9 +63,9 @@ constexpr basic_fixed_string superscript_number<8> = u8"\u2078"; template<> constexpr basic_fixed_string superscript_number<9> = u8"\u2079"; -constexpr symbol_text superscript_minus(u8"\u207b", "-"); +inline constexpr symbol_text superscript_minus(u8"\u207b", "-"); -constexpr symbol_text superscript_prefix(u8"", "^"); +inline constexpr symbol_text superscript_prefix(u8"", "^"); template [[nodiscard]] consteval auto superscript_helper() diff --git a/src/core/include/mp-units/compat_macros.h b/src/core/include/mp-units/compat_macros.h index f221bbbf0..4add3e128 100644 --- a/src/core/include/mp-units/compat_macros.h +++ b/src/core/include/mp-units/compat_macros.h @@ -28,14 +28,14 @@ #if MP_UNITS_API_NO_CRTP -#define QUANTITY_SPEC(name, ...) \ - constexpr struct name final : ::mp_units::quantity_spec<__VA_ARGS__> { \ +#define QUANTITY_SPEC(name, ...) \ + inline constexpr struct name final : ::mp_units::quantity_spec<__VA_ARGS__> { \ } name #else -#define QUANTITY_SPEC(name, ...) \ - constexpr struct name final : ::mp_units::quantity_spec { \ +#define QUANTITY_SPEC(name, ...) \ + inline constexpr struct name final : ::mp_units::quantity_spec { \ } name #endif diff --git a/src/core/include/mp-units/framework/dimension.h b/src/core/include/mp-units/framework/dimension.h index 71b630363..6b2cb3603 100644 --- a/src/core/include/mp-units/framework/dimension.h +++ b/src/core/include/mp-units/framework/dimension.h @@ -115,9 +115,9 @@ struct dimension_interface { * For example: * * @code{.cpp} - * constexpr struct dim_length final : base_dimension<"L"> {} dim_length; - * constexpr struct dim_time final : base_dimension<"T"> {} dim_time; - * constexpr struct dim_mass final : base_dimension<"M"> {} dim_mass; + * inline constexpr struct dim_length final : base_dimension<"L"> {} dim_length; + * inline constexpr struct dim_time final : base_dimension<"T"> {} dim_time; + * inline constexpr struct dim_mass final : base_dimension<"M"> {} dim_mass; * @endcode * * @note A common convention in this library is to assign the same name for a type and an object of this type. @@ -184,7 +184,9 @@ struct derived_dimension final : detail::dimension_interface, detail::derived_di * dimensions are zero. It is a dimension of a quantity of dimension one also known as * "dimensionless". */ -MP_UNITS_EXPORT constexpr struct dimension_one final : detail::dimension_interface, detail::derived_dimension_impl<> { +MP_UNITS_EXPORT inline constexpr struct dimension_one final : + detail::dimension_interface, + detail::derived_dimension_impl<> { } dimension_one; namespace detail { diff --git a/src/core/include/mp-units/framework/magnitude.h b/src/core/include/mp-units/framework/magnitude.h index 84312fd3b..afe91564d 100644 --- a/src/core/include/mp-units/framework/magnitude.h +++ b/src/core/include/mp-units/framework/magnitude.h @@ -725,12 +725,12 @@ MP_UNITS_EXPORT_BEGIN */ #if MP_UNITS_COMP_CLANG -constexpr struct mag_pi : magnitude}> { +inline constexpr struct mag_pi : magnitude}> { } mag_pi; #else -constexpr struct mag_pi : magnitude> { +inline constexpr struct mag_pi : magnitude> { } mag_pi; #endif @@ -959,7 +959,7 @@ template return integer_part((detail::abs(power_of_2) < detail::abs(power_of_5)) ? power_of_2 : power_of_5); } -constexpr symbol_text base_multiplier(u8"× 10", "x 10"); +inline constexpr symbol_text base_multiplier(u8"× 10", "x 10"); template [[nodiscard]] consteval auto magnitude_text() diff --git a/src/core/include/mp-units/framework/quantity_spec.h b/src/core/include/mp-units/framework/quantity_spec.h index a58a73e1c..d813b2a65 100644 --- a/src/core/include/mp-units/framework/quantity_spec.h +++ b/src/core/include/mp-units/framework/quantity_spec.h @@ -189,7 +189,7 @@ struct quantity_spec_interface : quantity_spec_interface_base { MP_UNITS_EXPORT_BEGIN -constexpr struct is_kind { +inline constexpr struct is_kind { } is_kind; /** @@ -235,13 +235,13 @@ MP_UNITS_EXPORT_END * For example: * * @code{.cpp} - * constexpr struct dim_length final : base_dimension<"L"> {} dim_length; - * constexpr struct dim_mass final : base_dimension<"M"> {} dim_mass; - * constexpr struct dim_time final : base_dimension<"T"> {} dim_time; + * inline constexpr struct dim_length final : base_dimension<"L"> {} dim_length; + * inline constexpr struct dim_mass final : base_dimension<"M"> {} dim_mass; + * inline constexpr struct dim_time final : base_dimension<"T"> {} dim_time; * - * constexpr struct length final : quantity_spec {} length; - * constexpr struct mass final : quantity_spec {} mass; - * 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; * @endcode * * @note A common convention in this library is to assign the same name for a type and an object of this type. @@ -280,12 +280,12 @@ struct quantity_spec : detail::quantity_spec_interface * For example: * * @code{.cpp} - * constexpr struct area final : quantity_spec(length)> {} area; - * constexpr struct volume final : quantity_spec(length)> {} volume; - * constexpr struct velocity final : quantity_spec {} velocity; - * constexpr struct speed final : quantity_spec {} speed; - * constexpr struct force final : quantity_spec {} force; - * constexpr struct power final : quantity_spec {} power; + * inline constexpr struct area final : quantity_spec(length)> {} area; + * inline constexpr struct volume final : quantity_spec(length)> {} volume; + * inline constexpr struct velocity final : quantity_spec {} velocity; + * inline constexpr struct speed final : quantity_spec {} speed; + * inline constexpr struct force final : quantity_spec {} force; + * inline constexpr struct power final : quantity_spec {} power; * @endcode * * @note A common convention in this library is to assign the same name for a type and an object of this type. @@ -335,10 +335,10 @@ struct propagate_equation { * For example: * * @code{.cpp} - * constexpr struct width final : quantity_spec {} width; - * constexpr struct height final : quantity_spec {} height; - * constexpr struct diameter final : quantity_spec {} diameter; - * constexpr struct position_vector final : quantity_spec {} position_vector; + * inline constexpr struct width final : quantity_spec {} width; + * inline constexpr struct height final : quantity_spec {} height; + * inline constexpr struct diameter final : quantity_spec {} diameter; + * inline constexpr struct position_vector final : quantity_spec {} position_vector; * @endcode * * @note A common convention in this library is to assign the same name for a type and an object of this type. @@ -396,10 +396,10 @@ struct quantity_spec : detail::propagate_equation, detail * For example: * * @code{.cpp} - * constexpr struct angular_measure final : quantity_spec {} angular_measure; - * constexpr struct velocity final : quantity_spec {} velocity; - * constexpr struct weight final : quantity_spec {} weight; - * constexpr struct kinetic_energy final : quantity_spec(speed)> {} kinetic_energy; + * inline constexpr struct angular_measure final : quantity_spec {} angular_measure; + * inline constexpr struct velocity final : quantity_spec {} velocity; + * inline constexpr struct weight final : quantity_spec {} weight; + * inline constexpr struct kinetic_energy final : quantity_spec(speed)> {} kinetic_energy; * @endcode * * @note A common convention in this library is to assign the same name for a type and an object of this type. diff --git a/src/core/include/mp-units/framework/system_reference.h b/src/core/include/mp-units/framework/system_reference.h index 6bac8d79b..3df21be25 100644 --- a/src/core/include/mp-units/framework/system_reference.h +++ b/src/core/include/mp-units/framework/system_reference.h @@ -45,15 +45,15 @@ namespace mp_units { * @code{.cpp} * // hypothetical natural system of units for c=1 * - * constexpr struct second final : named_unit<"s"> {} second; - * constexpr struct minute final : named_unit<"min", mag<60> * second> {} minute; - * constexpr struct gram final : named_unit<"g"> {} gram; - * constexpr auto kilogram = si::kilo; + * inline constexpr struct second final : named_unit<"s"> {} second; + * inline constexpr struct minute final : named_unit<"min", mag<60> * second> {} minute; + * inline constexpr struct gram final : named_unit<"g"> {} gram; + * inline constexpr auto kilogram = si::kilo; * - * constexpr struct time : system_reference {} time; - * constexpr struct length : system_reference {} length; - * constexpr struct speed : system_reference {} speed; - * constexpr struct force : system_reference {} force; + * inline constexpr struct time : system_reference {} time; + * inline constexpr struct length : system_reference {} length; + * inline constexpr struct speed : system_reference {} speed; + * inline constexpr struct force : system_reference {} force; * @endcode * * @tparam Q quantity for which a unit is being assigned diff --git a/src/core/include/mp-units/framework/unit.h b/src/core/include/mp-units/framework/unit.h index 1e5641071..269ef4d03 100644 --- a/src/core/include/mp-units/framework/unit.h +++ b/src/core/include/mp-units/framework/unit.h @@ -256,12 +256,12 @@ constexpr bool is_specialization_of_scaled_unit> = true; * For example: * * @code{.cpp} - * constexpr struct second final : named_unit<"s", kind_of B; + * inline constexpr struct A : absolute_point_origin A; + * inline constexpr struct B : relative_point_origin B; * * using ToQP = quantity_point; * auto qp = value_cast(quantity_point{1.23 * m}); diff --git a/src/systems/include/mp-units/systems/angular/units.h b/src/systems/include/mp-units/systems/angular/units.h index 75e5eaea3..a8e6e01d6 100644 --- a/src/systems/include/mp-units/systems/angular/units.h +++ b/src/systems/include/mp-units/systems/angular/units.h @@ -36,26 +36,26 @@ namespace mp_units { namespace angular { // clang-format off -constexpr struct dim_angle final : base_dimension<"A"> {} dim_angle; +inline constexpr struct dim_angle final : base_dimension<"A"> {} dim_angle; QUANTITY_SPEC(angle, dim_angle); QUANTITY_SPEC(solid_angle, pow<2>(angle)); -constexpr struct radian final : named_unit<"rad", kind_of> {} radian; -constexpr struct revolution final : named_unit<"rev", mag<2> * mag_pi * radian> {} revolution; -constexpr struct degree final : named_unit * revolution> {} degree; -constexpr struct gradian final : named_unit * revolution> {} gradian; -constexpr struct steradian final : named_unit<"sr", square(radian)> {} steradian; +inline constexpr struct radian final : named_unit<"rad", kind_of> {} radian; +inline constexpr struct revolution final : named_unit<"rev", mag<2> * mag_pi * radian> {} revolution; +inline constexpr struct degree final : named_unit * revolution> {} degree; +inline constexpr struct gradian final : named_unit * revolution> {} gradian; +inline constexpr struct steradian final : named_unit<"sr", square(radian)> {} steradian; // clang-format on namespace unit_symbols { -constexpr auto rad = radian; -constexpr auto rev = revolution; -constexpr auto deg = degree; -constexpr auto grad = gradian; -constexpr auto sr = steradian; -constexpr auto rad2 = square(radian); -constexpr auto deg2 = square(degree); +inline constexpr auto rad = radian; +inline constexpr auto rev = revolution; +inline constexpr auto deg = degree; +inline constexpr auto grad = gradian; +inline constexpr auto sr = steradian; +inline constexpr auto rad2 = square(radian); +inline constexpr auto deg2 = square(degree); } // namespace unit_symbols diff --git a/src/systems/include/mp-units/systems/cgs.h b/src/systems/include/mp-units/systems/cgs.h index ad65a7fab..9ae0d2650 100644 --- a/src/systems/include/mp-units/systems/cgs.h +++ b/src/systems/include/mp-units/systems/cgs.h @@ -35,35 +35,35 @@ MP_UNITS_EXPORT namespace mp_units::cgs { // clang-format off -constexpr auto centimetre = si::centi; -constexpr auto gram = si::gram; -constexpr auto second = si::second; -constexpr struct gal final : named_unit<"Gal", centimetre / square(second)> {} gal; -constexpr struct dyne final : named_unit<"dyn", gram * centimetre / square(second)> {} dyne; -constexpr struct erg final : named_unit<"erg", dyne * centimetre> {} erg; -constexpr struct barye final : named_unit<"Ba", gram / (centimetre * square(second))> {} barye; -constexpr struct poise final : named_unit<"P", gram / (centimetre * second)> {} poise; -constexpr struct stokes final : named_unit<"St", square(centimetre) / second> {} stokes; -constexpr struct kayser final : named_unit<"K", one / centimetre> {} kayser; +inline constexpr auto centimetre = si::centi; +inline constexpr auto gram = si::gram; +inline constexpr auto second = si::second; +inline constexpr struct gal final : named_unit<"Gal", centimetre / square(second)> {} gal; +inline constexpr struct dyne final : named_unit<"dyn", gram * centimetre / square(second)> {} dyne; +inline constexpr struct erg final : named_unit<"erg", dyne * centimetre> {} erg; +inline constexpr struct barye final : named_unit<"Ba", gram / (centimetre * square(second))> {} barye; +inline constexpr struct poise final : named_unit<"P", gram / (centimetre * second)> {} poise; +inline constexpr struct stokes final : named_unit<"St", square(centimetre) / second> {} stokes; +inline constexpr struct kayser final : named_unit<"K", one / centimetre> {} kayser; // clang-format on namespace unit_symbols { -constexpr auto cm = centimetre; -constexpr auto g = gram; -constexpr auto s = second; -constexpr auto Gal = gal; -constexpr auto dyn = dyne; -constexpr auto Ba = barye; -constexpr auto P = poise; -constexpr auto St = stokes; -constexpr auto K = kayser; +inline constexpr auto cm = centimetre; +inline constexpr auto g = gram; +inline constexpr auto s = second; +inline constexpr auto Gal = gal; +inline constexpr auto dyn = dyne; +inline constexpr auto Ba = barye; +inline constexpr auto P = poise; +inline constexpr auto St = stokes; +inline constexpr auto K = kayser; // commonly used squared and cubic units -constexpr auto cm2 = square(centimetre); -constexpr auto cm3 = cubic(centimetre); -constexpr auto s2 = square(second); -constexpr auto s3 = cubic(second); +inline constexpr auto cm2 = square(centimetre); +inline constexpr auto cm3 = cubic(centimetre); +inline constexpr auto s2 = square(second); +inline constexpr auto s3 = cubic(second); } // namespace unit_symbols diff --git a/src/systems/include/mp-units/systems/hep.h b/src/systems/include/mp-units/systems/hep.h index 8ea81cc3d..c64844f89 100644 --- a/src/systems/include/mp-units/systems/hep.h +++ b/src/systems/include/mp-units/systems/hep.h @@ -49,64 +49,64 @@ using si::electronvolt; // effective cross-sectional area according to EU council directive 80/181/EEC // https://eur-lex.europa.eu/legal-content/EN/TXT/PDF/?uri=CELEX:01980L0181-20090527#page=10 // https://www.fedlex.admin.ch/eli/cc/1994/3109_3109_3109/de -constexpr struct barn final : named_unit<"b", mag_power<10, -28> * square(si::metre)> {} barn; +inline constexpr struct barn final : named_unit<"b", mag_power<10, -28> * square(si::metre)> {} barn; // mass -constexpr struct electron_mass final : named_unit<"m_e", mag_ratio<9'109'383'701'528, 1'000'000'000'000> * mag_power<10, -31> * si::kilogram> {} electron_mass; -constexpr struct proton_mass final : named_unit<"m_p", mag_ratio<1'672'621'923'695, 1'000'000'000'000> * mag_power<10, -27> * si::kilogram> {} proton_mass; -constexpr struct neutron_mass final : named_unit<"m_n", mag_ratio<1'674'927'498'049, 1'000'000'000'000> * mag_power<10, -27> * si::kilogram> {} neutron_mass; +inline constexpr struct electron_mass final : named_unit<"m_e", mag_ratio<9'109'383'701'528, 1'000'000'000'000> * mag_power<10, -31> * si::kilogram> {} electron_mass; +inline constexpr struct proton_mass final : named_unit<"m_p", mag_ratio<1'672'621'923'695, 1'000'000'000'000> * mag_power<10, -27> * si::kilogram> {} proton_mass; +inline constexpr struct neutron_mass final : named_unit<"m_n", mag_ratio<1'674'927'498'049, 1'000'000'000'000> * mag_power<10, -27> * si::kilogram> {} neutron_mass; // speed -constexpr auto speed_of_light = si::si2019::speed_of_light_in_vacuum; +inline constexpr auto speed_of_light = si::si2019::speed_of_light_in_vacuum; // clang-format on namespace unit_symbols { using si::unit_symbols::eV; -constexpr auto qeV = si::quecto; -constexpr auto reV = si::ronto; -constexpr auto yeV = si::yocto; -constexpr auto zeV = si::zepto; -constexpr auto aeV = si::atto; -constexpr auto feV = si::femto; -constexpr auto peV = si::pico; -constexpr auto neV = si::nano; -constexpr auto ueV = si::micro; -constexpr auto meV = si::milli; -constexpr auto ceV = si::centi; -constexpr auto deV = si::deci; -constexpr auto daeV = si::deca; -constexpr auto heV = si::hecto; -constexpr auto keV = si::kilo; -constexpr auto MeV = si::mega; -constexpr auto GeV = si::giga; -constexpr auto TeV = si::tera; -constexpr auto PeV = si::peta; -constexpr auto EeV = si::exa; -constexpr auto ZeV = si::zetta; -constexpr auto YeV = si::yotta; -constexpr auto ReV = si::ronna; -constexpr auto QeV = si::quetta; - -constexpr auto qb = si::quecto; -constexpr auto rb = si::ronto; -constexpr auto yb = si::yocto; -constexpr auto zb = si::zepto; -constexpr auto ab = si::atto; -constexpr auto fb = si::femto; -constexpr auto pb = si::pico; -constexpr auto nb = si::nano; -constexpr auto ub = si::micro; -constexpr auto mb = si::milli; -constexpr auto b = barn; - -constexpr auto m_e = electron_mass; -constexpr auto m_p = proton_mass; -constexpr auto m_n = neutron_mass; - -constexpr auto c = speed_of_light; -constexpr auto c2 = square(speed_of_light); +inline constexpr auto qeV = si::quecto; +inline constexpr auto reV = si::ronto; +inline constexpr auto yeV = si::yocto; +inline constexpr auto zeV = si::zepto; +inline constexpr auto aeV = si::atto; +inline constexpr auto feV = si::femto; +inline constexpr auto peV = si::pico; +inline constexpr auto neV = si::nano; +inline constexpr auto ueV = si::micro; +inline constexpr auto meV = si::milli; +inline constexpr auto ceV = si::centi; +inline constexpr auto deV = si::deci; +inline constexpr auto daeV = si::deca; +inline constexpr auto heV = si::hecto; +inline constexpr auto keV = si::kilo; +inline constexpr auto MeV = si::mega; +inline constexpr auto GeV = si::giga; +inline constexpr auto TeV = si::tera; +inline constexpr auto PeV = si::peta; +inline constexpr auto EeV = si::exa; +inline constexpr auto ZeV = si::zetta; +inline constexpr auto YeV = si::yotta; +inline constexpr auto ReV = si::ronna; +inline constexpr auto QeV = si::quetta; + +inline constexpr auto qb = si::quecto; +inline constexpr auto rb = si::ronto; +inline constexpr auto yb = si::yocto; +inline constexpr auto zb = si::zepto; +inline constexpr auto ab = si::atto; +inline constexpr auto fb = si::femto; +inline constexpr auto pb = si::pico; +inline constexpr auto nb = si::nano; +inline constexpr auto ub = si::micro; +inline constexpr auto mb = si::milli; +inline constexpr auto b = barn; + +inline constexpr auto m_e = electron_mass; +inline constexpr auto m_p = proton_mass; +inline constexpr auto m_n = neutron_mass; + +inline constexpr auto c = speed_of_light; +inline constexpr auto c2 = square(speed_of_light); } // namespace unit_symbols } // namespace hep diff --git a/src/systems/include/mp-units/systems/iau.h b/src/systems/include/mp-units/systems/iau.h index d08c0c73f..c81777aa5 100644 --- a/src/systems/include/mp-units/systems/iau.h +++ b/src/systems/include/mp-units/systems/iau.h @@ -39,65 +39,65 @@ namespace mp_units::iau { // clang-format off // time -constexpr struct day final : named_unit<"D", si::day> {} day; -constexpr struct Julian_year final : named_unit<"a", mag_ratio<365'25, 100> * day> {} Julian_year; +inline constexpr struct day final : named_unit<"D", si::day> {} day; +inline constexpr struct Julian_year final : named_unit<"a", mag_ratio<365'25, 100> * day> {} Julian_year; // mass // https://en.wikipedia.org/wiki/Solar_mass // TODO What is the official mass of sun (every source in the Internet provides a different value) -constexpr struct solar_mass final : named_unit * mag_power<10, 30> * si::kilogram> {} solar_mass; -constexpr struct Jupiter_mass final : named_unit<"M_JUP", mag_ratio<1'898, 1'000> * mag_power<10, 27> * si::kilogram> {} Jupiter_mass; -constexpr struct Earth_mass final : named_unit<"M_EARTH", mag_ratio<59'742, 10'000> * mag_power<10, 24> * si::kilogram> {} Earth_mass; +inline constexpr struct solar_mass final : named_unit * mag_power<10, 30> * si::kilogram> {} solar_mass; +inline constexpr struct Jupiter_mass final : named_unit<"M_JUP", mag_ratio<1'898, 1'000> * mag_power<10, 27> * si::kilogram> {} Jupiter_mass; +inline constexpr struct Earth_mass final : named_unit<"M_EARTH", mag_ratio<59'742, 10'000> * mag_power<10, 24> * si::kilogram> {} Earth_mass; // length -constexpr auto astronomical_unit = si::astronomical_unit; +inline constexpr auto astronomical_unit = si::astronomical_unit; // https://en.wikipedia.org/wiki/Lunar_distance_(astronomy) -constexpr struct lunar_distance final : named_unit<"LD", mag<384'399> * si::kilo> {} lunar_distance; +inline constexpr struct lunar_distance final : named_unit<"LD", mag<384'399> * si::kilo> {} lunar_distance; // https://en.wikipedia.org/wiki/Light-year -constexpr struct light_year final : named_unit<"ly", mag<9'460'730'472'580'800> * si::metre> {} light_year; +inline constexpr struct light_year final : named_unit<"ly", mag<9'460'730'472'580'800> * si::metre> {} light_year; // https://en.wikipedia.org/wiki/Parsec -constexpr struct parsec final : named_unit<"pc", astronomical_unit / (mag_ratio<1, 3600> * si::degree)> {} parsec; +inline constexpr struct parsec final : named_unit<"pc", astronomical_unit / (mag_ratio<1, 3600> * si::degree)> {} parsec; // https://en.wikipedia.org/wiki/Angstrom -constexpr struct angstrom final : named_unit * si::metre> {} angstrom; +inline constexpr struct angstrom final : named_unit * si::metre> {} angstrom; // selected constants // https://en.wikipedia.org/wiki/Astronomical_constant -constexpr struct gaussian_gravitational_constant final : +inline constexpr struct gaussian_gravitational_constant final : named_unit<"k", mag_ratio<1'720'209'895, 100'000'000'000> * pow<3, 2>(astronomical_unit) / pow<1,2>(solar_mass) / day> {} gaussian_gravitational_constant; -constexpr struct speed_of_light final : +inline constexpr struct speed_of_light final : named_unit {} speed_of_light; -constexpr struct constant_of_gravitation final : +inline constexpr struct constant_of_gravitation final : named_unit<"G", mag_ratio<667'430, 100'000> * mag_power<10, -11> * cubic(si::metre) / si::kilogram / square(si::second)> {} constant_of_gravitation; -constexpr struct hubble_constant final : +inline constexpr struct hubble_constant final : named_unit * si::kilo / si::second / si::mega> {} hubble_constant; // clang-format on namespace unit_symbols { -constexpr auto D = day; -constexpr auto a = Julian_year; +inline constexpr auto D = day; +inline constexpr auto a = Julian_year; -constexpr auto M_SUN = solar_mass; -constexpr auto M_JUP = Jupiter_mass; -constexpr auto M_EARTH = Earth_mass; +inline constexpr auto M_SUN = solar_mass; +inline constexpr auto M_JUP = Jupiter_mass; +inline constexpr auto M_EARTH = Earth_mass; -constexpr auto au = astronomical_unit; -constexpr auto LD = lunar_distance; -constexpr auto ly = light_year; -constexpr auto pc = parsec; -constexpr auto A = angstrom; +inline constexpr auto au = astronomical_unit; +inline constexpr auto LD = lunar_distance; +inline constexpr auto ly = light_year; +inline constexpr auto pc = parsec; +inline constexpr auto A = angstrom; -constexpr auto k = gaussian_gravitational_constant; -constexpr auto c_0 = speed_of_light; -constexpr auto G = constant_of_gravitation; -constexpr auto H_0 = hubble_constant; +inline constexpr auto k = gaussian_gravitational_constant; +inline constexpr auto c_0 = speed_of_light; +inline constexpr auto G = constant_of_gravitation; +inline constexpr auto H_0 = hubble_constant; } // namespace unit_symbols diff --git a/src/systems/include/mp-units/systems/iec80000/quantities.h b/src/systems/include/mp-units/systems/iec80000/quantities.h index f4717308f..f9b23547a 100644 --- a/src/systems/include/mp-units/systems/iec80000/quantities.h +++ b/src/systems/include/mp-units/systems/iec80000/quantities.h @@ -36,40 +36,40 @@ namespace mp_units::iec80000 { // dimensions of base quantities // clang-format off -constexpr struct dim_traffic_intensity final : base_dimension<"A"> {} dim_traffic_intensity; +inline constexpr struct dim_traffic_intensity final : base_dimension<"A"> {} dim_traffic_intensity; // clang-format on // quantities QUANTITY_SPEC(traffic_intensity, dim_traffic_intensity); QUANTITY_SPEC(traffic_offered_intensity, traffic_intensity); QUANTITY_SPEC(traffic_carried_intensity, traffic_intensity); -constexpr auto traffic_load = traffic_carried_intensity; +inline constexpr auto traffic_load = traffic_carried_intensity; QUANTITY_SPEC(mean_queue_length, dimensionless); QUANTITY_SPEC(loss_probability, dimensionless); QUANTITY_SPEC(waiting_probability, dimensionless); QUANTITY_SPEC(call_intensity, inverse(isq::duration)); -constexpr auto calling_rate = call_intensity; +inline constexpr auto calling_rate = call_intensity; QUANTITY_SPEC(completed_call_intensity, call_intensity); QUANTITY_SPEC(storage_capacity, dimensionless, is_kind); -constexpr auto storage_size = storage_capacity; +inline constexpr auto storage_size = storage_capacity; QUANTITY_SPEC(equivalent_binary_storage_capacity, storage_capacity); QUANTITY_SPEC(transfer_rate, storage_capacity / isq::duration); QUANTITY_SPEC(period_of_data_elements, isq::period, inverse(transfer_rate)); QUANTITY_SPEC(binary_digit_rate, transfer_rate); -constexpr auto bit_rate = binary_digit_rate; +inline constexpr auto bit_rate = binary_digit_rate; QUANTITY_SPEC(period_of_binary_digits, isq::period, inverse(binary_digit_rate)); -constexpr auto bit_period = period_of_binary_digits; +inline constexpr auto bit_period = period_of_binary_digits; QUANTITY_SPEC(equivalent_binary_digit_rate, binary_digit_rate); -constexpr auto equivalent_bit_rate = bit_rate; +inline constexpr auto equivalent_bit_rate = bit_rate; QUANTITY_SPEC(modulation_rate, inverse(isq::duration)); -constexpr auto line_digit_rate = modulation_rate; +inline constexpr auto line_digit_rate = modulation_rate; QUANTITY_SPEC(quantizing_distortion_power, isq::power); QUANTITY_SPEC(carrier_power, isq::power); QUANTITY_SPEC(signal_energy_per_binary_digit, carrier_power* period_of_binary_digits); QUANTITY_SPEC(error_probability, dimensionless); QUANTITY_SPEC(Hamming_distance, dimensionless); QUANTITY_SPEC(clock_frequency, isq::frequency); -constexpr auto clock_rate = clock_frequency; +inline constexpr auto clock_rate = clock_frequency; QUANTITY_SPEC(decision_content, dimensionless); // TODO how to model information_content and the following quantities??? diff --git a/src/systems/include/mp-units/systems/iec80000/unit_symbols.h b/src/systems/include/mp-units/systems/iec80000/unit_symbols.h index 873d731fc..53d423a8d 100644 --- a/src/systems/include/mp-units/systems/iec80000/unit_symbols.h +++ b/src/systems/include/mp-units/systems/iec80000/unit_symbols.h @@ -31,81 +31,81 @@ MP_UNITS_EXPORT namespace mp_units::iec80000::unit_symbols { // bit -constexpr auto kbit = si::kilo; -constexpr auto Mbit = si::mega; -constexpr auto Gbit = si::giga; -constexpr auto Tbit = si::tera; -constexpr auto Pbit = si::peta; -constexpr auto Ebit = si::exa; -constexpr auto Zbit = si::zetta; -constexpr auto Ybit = si::yotta; -constexpr auto Rbit = si::ronna; -constexpr auto Qbit = si::quetta; +inline constexpr auto kbit = si::kilo; +inline constexpr auto Mbit = si::mega; +inline constexpr auto Gbit = si::giga; +inline constexpr auto Tbit = si::tera; +inline constexpr auto Pbit = si::peta; +inline constexpr auto Ebit = si::exa; +inline constexpr auto Zbit = si::zetta; +inline constexpr auto Ybit = si::yotta; +inline constexpr auto Rbit = si::ronna; +inline constexpr auto Qbit = si::quetta; -constexpr auto Kibit = kibi; -constexpr auto Mibit = mebi; -constexpr auto Gibit = gibi; -constexpr auto Tibit = tebi; -constexpr auto Pibit = pebi; -constexpr auto Eibit = exbi; +inline constexpr auto Kibit = kibi; +inline constexpr auto Mibit = mebi; +inline constexpr auto Gibit = gibi; +inline constexpr auto Tibit = tebi; +inline constexpr auto Pibit = pebi; +inline constexpr auto Eibit = exbi; // octet -constexpr auto o = octet; +inline constexpr auto o = octet; -constexpr auto ko = si::kilo; -constexpr auto Mo = si::mega; -constexpr auto Go = si::giga; -constexpr auto To = si::tera; -constexpr auto Po = si::peta; -constexpr auto Eo = si::exa; -constexpr auto Zo = si::zetta; -constexpr auto Yo = si::yotta; -constexpr auto Ro = si::ronna; -constexpr auto Qo = si::quetta; +inline constexpr auto ko = si::kilo; +inline constexpr auto Mo = si::mega; +inline constexpr auto Go = si::giga; +inline constexpr auto To = si::tera; +inline constexpr auto Po = si::peta; +inline constexpr auto Eo = si::exa; +inline constexpr auto Zo = si::zetta; +inline constexpr auto Yo = si::yotta; +inline constexpr auto Ro = si::ronna; +inline constexpr auto Qo = si::quetta; -constexpr auto Kio = kibi; -constexpr auto Mio = mebi; -constexpr auto Gio = gibi; -constexpr auto Tio = tebi; -constexpr auto Pio = pebi; -constexpr auto Eio = exbi; +inline constexpr auto Kio = kibi; +inline constexpr auto Mio = mebi; +inline constexpr auto Gio = gibi; +inline constexpr auto Tio = tebi; +inline constexpr auto Pio = pebi; +inline constexpr auto Eio = exbi; // byte -constexpr auto B = byte; +inline constexpr auto B = byte; -constexpr auto kB = si::kilo; -constexpr auto MB = si::mega; -constexpr auto GB = si::giga; -constexpr auto TB = si::tera; -constexpr auto PB = si::peta; -constexpr auto EB = si::exa; -constexpr auto ZB = si::zetta; -constexpr auto YB = si::yotta; -constexpr auto RB = si::ronna; -constexpr auto QB = si::quetta; +inline constexpr auto kB = si::kilo; +inline constexpr auto MB = si::mega; +inline constexpr auto GB = si::giga; +inline constexpr auto TB = si::tera; +inline constexpr auto PB = si::peta; +inline constexpr auto EB = si::exa; +inline constexpr auto ZB = si::zetta; +inline constexpr auto YB = si::yotta; +inline constexpr auto RB = si::ronna; +inline constexpr auto QB = si::quetta; -constexpr auto KiB = kibi; -constexpr auto MiB = mebi; -constexpr auto GiB = gibi; -constexpr auto TiB = tebi; -constexpr auto PiB = pebi; -constexpr auto EiB = exbi; +inline constexpr auto KiB = kibi; +inline constexpr auto MiB = mebi; +inline constexpr auto GiB = gibi; +inline constexpr auto TiB = tebi; +inline constexpr auto PiB = pebi; +inline constexpr auto EiB = exbi; // baud -constexpr auto Bd = baud; -constexpr auto kBd = si::kilo; -constexpr auto MBd = si::mega; -constexpr auto GBd = si::giga; -constexpr auto TBd = si::tera; -constexpr auto PBd = si::peta; -constexpr auto EBd = si::exa; -constexpr auto ZBd = si::zetta; -constexpr auto YBd = si::yotta; -constexpr auto RBd = si::ronna; -constexpr auto QBd = si::quetta; +inline constexpr auto Bd = baud; +inline constexpr auto kBd = si::kilo; +inline constexpr auto MBd = si::mega; +inline constexpr auto GBd = si::giga; +inline constexpr auto TBd = si::tera; +inline constexpr auto PBd = si::peta; +inline constexpr auto EBd = si::exa; +inline constexpr auto ZBd = si::zetta; +inline constexpr auto YBd = si::yotta; +inline constexpr auto RBd = si::ronna; +inline constexpr auto QBd = si::quetta; // erlang // TODO do we need prefixed versions of Erlang? -constexpr auto E = erlang; +inline constexpr auto E = erlang; } // namespace mp_units::iec80000::unit_symbols diff --git a/src/systems/include/mp-units/systems/iec80000/units.h b/src/systems/include/mp-units/systems/iec80000/units.h index 41f28c5ff..4d1ee0983 100644 --- a/src/systems/include/mp-units/systems/iec80000/units.h +++ b/src/systems/include/mp-units/systems/iec80000/units.h @@ -34,11 +34,11 @@ MP_UNITS_EXPORT namespace mp_units::iec80000 { // clang-format off -constexpr struct erlang final : named_unit<"E", kind_of> {} erlang; -constexpr struct bit final : named_unit<"bit", one, kind_of> {} bit; -constexpr struct octet final : named_unit<"o", mag<8> * bit> {} octet; -constexpr struct byte final : named_unit<"B", mag<8> * bit> {} byte; -constexpr struct baud final : named_unit<"Bd", one / si::second, kind_of> {} baud; +inline constexpr struct erlang final : named_unit<"E", kind_of> {} erlang; +inline constexpr struct bit final : named_unit<"bit", one, kind_of> {} bit; +inline constexpr struct octet final : named_unit<"o", mag<8> * bit> {} octet; +inline constexpr struct byte final : named_unit<"B", mag<8> * bit> {} byte; +inline constexpr struct baud final : named_unit<"Bd", one / si::second, kind_of> {} baud; // clang-format on } // namespace mp_units::iec80000 diff --git a/src/systems/include/mp-units/systems/imperial.h b/src/systems/include/mp-units/systems/imperial.h index 8c80ce56a..8ba61e053 100644 --- a/src/systems/include/mp-units/systems/imperial.h +++ b/src/systems/include/mp-units/systems/imperial.h @@ -39,67 +39,67 @@ using namespace international; // clang-format off // https://en.wikipedia.org/wiki/Imperial_units#Length -constexpr struct hand final : named_unit<"hh", mag_ratio<1, 3> * foot> {} hand; -constexpr struct barleycorn final : named_unit<"Bc", mag_ratio<1, 3> * inch> {} barleycorn; -constexpr struct thou final : named_unit<"th", mag_ratio<1, 12'000> * foot> {} thou; -constexpr struct chain final : named_unit<"ch", mag<22> * yard> {} chain; -constexpr struct furlong final : named_unit<"fur", mag<10> * chain> {} furlong; +inline constexpr struct hand final : named_unit<"hh", mag_ratio<1, 3> * foot> {} hand; +inline constexpr struct barleycorn final : named_unit<"Bc", mag_ratio<1, 3> * inch> {} barleycorn; +inline constexpr struct thou final : named_unit<"th", mag_ratio<1, 12'000> * foot> {} thou; +inline constexpr struct chain final : named_unit<"ch", mag<22> * yard> {} chain; +inline constexpr struct furlong final : named_unit<"fur", mag<10> * chain> {} furlong; // maritime units -constexpr struct cable final : named_unit<"cb", mag_ratio<1, 10> * nautical_mile> {} cable; -constexpr struct fathom final : named_unit<"ftm", mag_ratio<1, 1000> * nautical_mile> {} fathom; +inline constexpr struct cable final : named_unit<"cb", mag_ratio<1, 10> * nautical_mile> {} cable; +inline constexpr struct fathom final : named_unit<"ftm", mag_ratio<1, 1000> * nautical_mile> {} fathom; // survey -constexpr struct link final : named_unit<"li", mag_ratio<1, 100> * chain> {} link; -constexpr struct rod final : named_unit<"rd", mag<25> * link> {} rod; +inline constexpr struct link final : named_unit<"li", mag_ratio<1, 100> * chain> {} link; +inline constexpr struct rod final : named_unit<"rd", mag<25> * link> {} rod; // https://en.wikipedia.org/wiki/Imperial_units#Area -constexpr struct perch final : named_unit<"perch", square(rod)> {} perch; -constexpr struct rood final : named_unit<"rood", mag<40> * perch> {} rood; -constexpr struct acre final : named_unit<"acre", mag<4> * rood> {} acre; +inline constexpr struct perch final : named_unit<"perch", square(rod)> {} perch; +inline constexpr struct rood final : named_unit<"rood", mag<40> * perch> {} rood; +inline constexpr struct acre final : named_unit<"acre", mag<4> * rood> {} acre; // https://en.wikipedia.org/wiki/Imperial_units#Volume -constexpr struct gallon final : named_unit<"gal", mag_ratio<454'609, 100'000> * si::litre> {} gallon; -constexpr struct quart final : named_unit<"qt", mag_ratio<1, 4> * gallon> {} quart; -constexpr struct pint final : named_unit<"pt", mag_ratio<1, 2> * quart> {} pint; -constexpr struct gill final : named_unit<"gi", mag_ratio<1, 4> * pint> {} gill; -constexpr struct fluid_ounce final : named_unit<"fl oz", mag_ratio<1, 5> * gill> {} fluid_ounce; +inline constexpr struct gallon final : named_unit<"gal", mag_ratio<454'609, 100'000> * si::litre> {} gallon; +inline constexpr struct quart final : named_unit<"qt", mag_ratio<1, 4> * gallon> {} quart; +inline constexpr struct pint final : named_unit<"pt", mag_ratio<1, 2> * quart> {} pint; +inline constexpr struct gill final : named_unit<"gi", mag_ratio<1, 4> * pint> {} gill; +inline constexpr struct fluid_ounce final : named_unit<"fl oz", mag_ratio<1, 5> * gill> {} fluid_ounce; // https://en.wikipedia.org/wiki/Avoirdupois_system#Post-Elizabethan_units -constexpr auto drachm = dram; -constexpr struct stone final : named_unit<"st", mag<14> * pound> {} stone; -constexpr struct quarter final : named_unit<"qr", mag<2> * stone> {} quarter; -constexpr struct long_hundredweight final : named_unit<"cwt", mag<8> * stone> {} long_hundredweight; -constexpr struct ton final : named_unit<"t", mag<2'240> * pound> {} ton; -constexpr auto long_ton = ton; +inline constexpr auto drachm = dram; +inline constexpr struct stone final : named_unit<"st", mag<14> * pound> {} stone; +inline constexpr struct quarter final : named_unit<"qr", mag<2> * stone> {} quarter; +inline constexpr struct long_hundredweight final : named_unit<"cwt", mag<8> * stone> {} long_hundredweight; +inline constexpr struct ton final : named_unit<"t", mag<2'240> * pound> {} ton; +inline constexpr auto long_ton = ton; // clang-format on namespace unit_symbols { using namespace international::unit_symbols; -constexpr auto hh = hand; -constexpr auto Bc = barleycorn; -constexpr auto th = thou; -constexpr auto ch = chain; -constexpr auto fur = furlong; +inline constexpr auto hh = hand; +inline constexpr auto Bc = barleycorn; +inline constexpr auto th = thou; +inline constexpr auto ch = chain; +inline constexpr auto fur = furlong; -constexpr auto cb = cable; -constexpr auto ftm = fathom; +inline constexpr auto cb = cable; +inline constexpr auto ftm = fathom; -constexpr auto li = link; -constexpr auto rd = rod; +inline constexpr auto li = link; +inline constexpr auto rd = rod; -constexpr auto gal = gallon; -constexpr auto qt = quart; -constexpr auto pt = pint; -constexpr auto gi = gill; -constexpr auto fl_oz = fluid_ounce; +inline constexpr auto gal = gallon; +inline constexpr auto qt = quart; +inline constexpr auto pt = pint; +inline constexpr auto gi = gill; +inline constexpr auto fl_oz = fluid_ounce; -constexpr auto st = stone; -constexpr auto qr = quarter; -constexpr auto cwt = long_hundredweight; -constexpr auto t = ton; +inline constexpr auto st = stone; +inline constexpr auto qr = quarter; +inline constexpr auto cwt = long_hundredweight; +inline constexpr auto t = ton; } // namespace unit_symbols diff --git a/src/systems/include/mp-units/systems/international.h b/src/systems/include/mp-units/systems/international.h index 206e3c7e3..1d5141f60 100644 --- a/src/systems/include/mp-units/systems/international.h +++ b/src/systems/include/mp-units/systems/international.h @@ -37,72 +37,72 @@ namespace mp_units::international { // clang-format off // mass -constexpr struct pound final : named_unit<"lb", mag_ratio<45'359'237, 100'000'000> * si::kilogram> {} pound; -constexpr struct ounce final : named_unit<"oz", mag_ratio<1, 16> * pound> {} ounce; -constexpr struct dram final : named_unit<"dr", mag_ratio<1, 16> * ounce> {} dram; -constexpr struct grain final : named_unit<"gr", mag_ratio<1, 7'000> * pound> {} grain; +inline constexpr struct pound final : named_unit<"lb", mag_ratio<45'359'237, 100'000'000> * si::kilogram> {} pound; +inline constexpr struct ounce final : named_unit<"oz", mag_ratio<1, 16> * pound> {} ounce; +inline constexpr struct dram final : named_unit<"dr", mag_ratio<1, 16> * ounce> {} dram; +inline constexpr struct grain final : named_unit<"gr", mag_ratio<1, 7'000> * pound> {} grain; // length // https://en.wikipedia.org/wiki/United_States_customary_units#Length -constexpr struct yard final : named_unit<"yd", mag_ratio<9'144, 10'000> * si::metre> {} yard; -constexpr struct foot final : named_unit<"ft", mag_ratio<1, 3> * yard> {} foot; -constexpr struct inch final : named_unit<"in", mag_ratio<1, 12> * foot> {} inch; -constexpr struct pica final : named_unit<"P", mag_ratio<1, 6> * inch> {} pica; -constexpr struct point final : named_unit<"p", mag_ratio<1, 12> * pica> {} point; -constexpr struct mil final : named_unit<"mil", mag_ratio<1, 1'000> * inch> {} mil; -constexpr struct twip final : named_unit<"twip", mag_ratio<1, 20> * point> {} twip; -constexpr struct mile final : named_unit<"mi", mag<1760> * yard> {} mile; -constexpr struct league final : named_unit<"le", mag<3> * mile> {} league; - -constexpr struct nautical_mile final : named_unit<"nmi", mag<1852> * si::metre> {} nautical_mile; +inline constexpr struct yard final : named_unit<"yd", mag_ratio<9'144, 10'000> * si::metre> {} yard; +inline constexpr struct foot final : named_unit<"ft", mag_ratio<1, 3> * yard> {} foot; +inline constexpr struct inch final : named_unit<"in", mag_ratio<1, 12> * foot> {} inch; +inline constexpr struct pica final : named_unit<"P", mag_ratio<1, 6> * inch> {} pica; +inline constexpr struct point final : named_unit<"p", mag_ratio<1, 12> * pica> {} point; +inline constexpr struct mil final : named_unit<"mil", mag_ratio<1, 1'000> * inch> {} mil; +inline constexpr struct twip final : named_unit<"twip", mag_ratio<1, 20> * point> {} twip; +inline constexpr struct mile final : named_unit<"mi", mag<1760> * yard> {} mile; +inline constexpr struct league final : named_unit<"le", mag<3> * mile> {} league; + +inline constexpr struct nautical_mile final : named_unit<"nmi", mag<1852> * si::metre> {} nautical_mile; // speed -constexpr struct knot final : named_unit<"kn", nautical_mile / si::hour> {} knot; +inline constexpr struct knot final : named_unit<"kn", nautical_mile / si::hour> {} knot; // force // https://en.wikipedia.org/wiki/Poundal -constexpr struct poundal final : named_unit<"pdl", pound * foot / square(si::second)> {} poundal; +inline constexpr struct poundal final : named_unit<"pdl", pound * foot / square(si::second)> {} poundal; // https://en.wikipedia.org/wiki/Pound_(force) -constexpr struct pound_force final : named_unit<"lbf", pound * si::standard_gravity> {} pound_force; +inline constexpr struct pound_force final : named_unit<"lbf", pound * si::standard_gravity> {} pound_force; // https://en.wikipedia.org/wiki/Kip_(unit), -constexpr auto kip = si::kilo; +inline constexpr auto kip = si::kilo; // pressure -constexpr struct psi final : named_unit<"psi", pound_force / square(inch)> {} psi; +inline constexpr struct psi final : named_unit<"psi", pound_force / square(inch)> {} psi; // power // https://en.wikipedia.org/wiki/Horsepower#Definitions -constexpr struct mechanical_horsepower final : named_unit<"hp(I)", mag<33'000> * foot * pound_force / si::minute> {} mechanical_horsepower; +inline constexpr struct mechanical_horsepower final : named_unit<"hp(I)", mag<33'000> * foot * pound_force / si::minute> {} mechanical_horsepower; // clang-format on namespace unit_symbols { -constexpr auto lb = pound; -constexpr auto oz = ounce; -constexpr auto dr = dram; -constexpr auto gr = grain; +inline constexpr auto lb = pound; +inline constexpr auto oz = ounce; +inline constexpr auto dr = dram; +inline constexpr auto gr = grain; -constexpr auto yd = yard; -constexpr auto ft = foot; -constexpr auto in = inch; -constexpr auto P = pica; -constexpr auto p = point; -constexpr auto mi = mile; -constexpr auto le = league; +inline constexpr auto yd = yard; +inline constexpr auto ft = foot; +inline constexpr auto in = inch; +inline constexpr auto P = pica; +inline constexpr auto p = point; +inline constexpr auto mi = mile; +inline constexpr auto le = league; -constexpr auto nmi = nautical_mile; +inline constexpr auto nmi = nautical_mile; -constexpr auto kn = knot; -constexpr auto kt = knot; -constexpr auto mph = mile / si::hour; +inline constexpr auto kn = knot; +inline constexpr auto kt = knot; +inline constexpr auto mph = mile / si::hour; -constexpr auto pdl = poundal; -constexpr auto lbf = pound_force; +inline constexpr auto pdl = poundal; +inline constexpr auto lbf = pound_force; -constexpr auto hp = mechanical_horsepower; +inline constexpr auto hp = mechanical_horsepower; } // namespace unit_symbols diff --git a/src/systems/include/mp-units/systems/isq/base_quantities.h b/src/systems/include/mp-units/systems/isq/base_quantities.h index 7e9ea0176..c7f4f337e 100644 --- a/src/systems/include/mp-units/systems/isq/base_quantities.h +++ b/src/systems/include/mp-units/systems/isq/base_quantities.h @@ -35,20 +35,20 @@ namespace mp_units::isq { // clang-format off // dimensions of base quantities -constexpr struct dim_length final : base_dimension<"L"> {} dim_length; -constexpr struct dim_mass final : base_dimension<"M"> {} dim_mass; -constexpr struct dim_time final : base_dimension<"T"> {} dim_time; -constexpr struct dim_electric_current final : base_dimension<"I"> {} dim_electric_current; -constexpr struct dim_thermodynamic_temperature final : base_dimension {} dim_thermodynamic_temperature; -constexpr struct dim_amount_of_substance final : base_dimension<"N"> {} dim_amount_of_substance; -constexpr struct dim_luminous_intensity final : base_dimension<"J"> {} dim_luminous_intensity; +inline constexpr struct dim_length final : base_dimension<"L"> {} dim_length; +inline constexpr struct dim_mass final : base_dimension<"M"> {} dim_mass; +inline constexpr struct dim_time final : base_dimension<"T"> {} dim_time; +inline constexpr struct dim_electric_current final : base_dimension<"I"> {} dim_electric_current; +inline constexpr struct dim_thermodynamic_temperature final : base_dimension {} dim_thermodynamic_temperature; +inline constexpr struct dim_amount_of_substance final : base_dimension<"N"> {} dim_amount_of_substance; +inline constexpr struct dim_luminous_intensity final : base_dimension<"J"> {} dim_luminous_intensity; // clang-format on // base quantities QUANTITY_SPEC(length, dim_length); QUANTITY_SPEC(mass, dim_mass); QUANTITY_SPEC(time, dim_time); -constexpr auto duration = time; +inline constexpr auto duration = time; QUANTITY_SPEC(electric_current, dim_electric_current); QUANTITY_SPEC(thermodynamic_temperature, dim_thermodynamic_temperature); QUANTITY_SPEC(amount_of_substance, dim_amount_of_substance); diff --git a/src/systems/include/mp-units/systems/isq/electromagnetism.h b/src/systems/include/mp-units/systems/isq/electromagnetism.h index 84f556ba8..bdb5bc8b2 100644 --- a/src/systems/include/mp-units/systems/isq/electromagnetism.h +++ b/src/systems/include/mp-units/systems/isq/electromagnetism.h @@ -39,25 +39,25 @@ namespace mp_units::isq { QUANTITY_SPEC(electric_charge, electric_current* time); QUANTITY_SPEC(electric_charge_density, electric_charge / volume); -constexpr auto volume_electric_charge = electric_charge_density; +inline constexpr auto volume_electric_charge = electric_charge_density; QUANTITY_SPEC(surface_density_of_electric_charge, electric_charge / area); -constexpr auto areic_electric_charge = surface_density_of_electric_charge; +inline constexpr auto areic_electric_charge = surface_density_of_electric_charge; QUANTITY_SPEC(linear_density_of_electric_charge, electric_charge / length); -constexpr auto lineic_electric_charge = linear_density_of_electric_charge; +inline constexpr auto lineic_electric_charge = linear_density_of_electric_charge; QUANTITY_SPEC(electric_dipole_moment, electric_charge* position_vector); // vector QUANTITY_SPEC(electric_polarization, electric_dipole_moment / volume); // vector QUANTITY_SPEC(electric_current_density, electric_charge_density* velocity); // vector -constexpr auto areic_electric_current = electric_current_density; +inline constexpr auto areic_electric_current = electric_current_density; QUANTITY_SPEC(linear_electric_current_density, surface_density_of_electric_charge* velocity); // vector -constexpr auto lineic_electric_current = linear_electric_current_density; +inline constexpr auto lineic_electric_current = linear_electric_current_density; QUANTITY_SPEC(electric_field_strength, force / electric_charge); // vector QUANTITY_SPEC(electric_potential, electric_field_strength* length, quantity_character::scalar); // TODO what is a correct equation here? QUANTITY_SPEC(electric_potential_difference, electric_potential, quantity_character::scalar); QUANTITY_SPEC(voltage, electric_potential); -constexpr auto electric_tension = voltage; +inline constexpr auto electric_tension = voltage; QUANTITY_SPEC(electric_flux_density, electric_polarization); // vector -constexpr auto electric_displacement = electric_flux_density; +inline constexpr auto electric_displacement = electric_flux_density; QUANTITY_SPEC(capacitance, electric_charge / voltage); // TODO how to calculate an argument of a vector product? QUANTITY_SPEC(magnetic_flux_density, force / (electric_charge * velocity), quantity_character::vector); @@ -66,13 +66,13 @@ QUANTITY_SPEC(magnetic_vector_potential, QUANTITY_SPEC(linked_flux, magnetic_vector_potential* displacement, quantity_character::scalar); QUANTITY_SPEC(magnetic_constant, electric_potential* time / (electric_current * length)); // TODO what is a correct equation here? -constexpr auto permeability_of_vacuum = magnetic_constant; +inline constexpr auto permeability_of_vacuum = magnetic_constant; QUANTITY_SPEC(phase_speed_of_electromagnetic_waves, angular_frequency / angular_wavenumber); QUANTITY_SPEC(speed_of_light_in_vacuum, speed); -constexpr auto light_speed_in_vacuum = speed_of_light_in_vacuum; -constexpr auto luminal_speed = speed_of_light_in_vacuum; +inline constexpr auto light_speed_in_vacuum = speed_of_light_in_vacuum; +inline constexpr auto luminal_speed = speed_of_light_in_vacuum; QUANTITY_SPEC(electric_constant, inverse(magnetic_constant* pow<2>(speed_of_light_in_vacuum))); -constexpr auto permittivity_of_vacuum = electric_constant; +inline constexpr auto permittivity_of_vacuum = electric_constant; QUANTITY_SPEC(permittivity, electric_flux_density / electric_field_strength, quantity_character::scalar); QUANTITY_SPEC(relative_permittivity, dimensionless, permittivity / electric_constant); QUANTITY_SPEC(electric_susceptibility, dimensionless, @@ -84,10 +84,10 @@ QUANTITY_SPEC(total_current, electric_current); QUANTITY_SPEC(total_current_density, electric_current_density); // vector QUANTITY_SPEC(magnetic_flux, magnetic_flux_density* area, quantity_character::scalar); QUANTITY_SPEC(magnetic_moment, electric_current* area, quantity_character::vector); -constexpr auto magnetic_area_moment = magnetic_moment; +inline constexpr auto magnetic_area_moment = magnetic_moment; QUANTITY_SPEC(magnetization, magnetic_moment / volume); // vector QUANTITY_SPEC(magnetic_field_strength, magnetization); // vector -constexpr auto magnetizing_field = magnetic_field_strength; +inline constexpr auto magnetizing_field = magnetic_field_strength; QUANTITY_SPEC(permeability, magnetic_flux_density / magnetic_field_strength, quantity_character::scalar); QUANTITY_SPEC(relative_permeability, dimensionless, permeability / magnetic_constant); QUANTITY_SPEC(magnetic_susceptibility, dimensionless, magnetization / magnetic_field_strength, @@ -97,10 +97,10 @@ QUANTITY_SPEC(magnetic_dipole_moment, magnetic_constant* magnetic_moment); // v QUANTITY_SPEC(coercivity, magnetic_field_strength, quantity_character::scalar); QUANTITY_SPEC(electromagnetic_energy_density, electric_field_strength* electric_flux_density, quantity_character::scalar); -constexpr auto volumic_electromagnetic_energy = electromagnetic_energy_density; +inline constexpr auto volumic_electromagnetic_energy = electromagnetic_energy_density; QUANTITY_SPEC(Poynting_vector, electric_field_strength* magnetic_field_strength); // vector QUANTITY_SPEC(source_voltage, voltage); -constexpr auto source_tension = source_voltage; +inline constexpr auto source_tension = source_voltage; QUANTITY_SPEC(scalar_magnetic_potential, electric_current, magnetic_field_strength* length, quantity_character::scalar); // TODO what is a correct equation here? QUANTITY_SPEC(magnetic_tension, electric_current, magnetic_field_strength* position_vector, quantity_character::scalar); @@ -111,26 +111,26 @@ QUANTITY_SPEC(number_of_turns_in_a_winding, dimensionless); QUANTITY_SPEC(reluctance, magnetic_tension / magnetic_flux); QUANTITY_SPEC(permeance, inverse(reluctance)); QUANTITY_SPEC(inductance, linked_flux / electric_current); -constexpr auto self_inductance = inductance; +inline constexpr auto self_inductance = inductance; QUANTITY_SPEC(mutual_inductance, linked_flux / electric_current); QUANTITY_SPEC(coupling_factor, dimensionless, mutual_inductance / pow<1, 2>(pow<2>(self_inductance))); QUANTITY_SPEC(leakage_factor, dimensionless, pow<2>(coupling_factor)); QUANTITY_SPEC(conductivity, electric_current_density / electric_field_strength, quantity_character::scalar); QUANTITY_SPEC(resistivity, inverse(conductivity)); QUANTITY_SPEC(electromagnetism_power, power, voltage* electric_current); -constexpr auto instantaneous_power = electromagnetism_power; +inline constexpr auto instantaneous_power = electromagnetism_power; QUANTITY_SPEC(resistance, voltage / electric_current); QUANTITY_SPEC(conductance, inverse(resistance)); QUANTITY_SPEC(phase_difference, phase_angle); QUANTITY_SPEC(electric_current_phasor, electric_current); QUANTITY_SPEC(voltage_phasor, voltage); QUANTITY_SPEC(impedance, voltage_phasor / electric_current_phasor); -constexpr auto complex_impedance = impedance; +inline constexpr auto complex_impedance = impedance; QUANTITY_SPEC(resistance_to_alternating_current, impedance); QUANTITY_SPEC(reactance, impedance); QUANTITY_SPEC(modulus_of_impedance, impedance); QUANTITY_SPEC(admittance, inverse(impedance)); -constexpr auto complex_admittance = admittance; +inline constexpr auto complex_admittance = admittance; QUANTITY_SPEC(conductance_for_alternating_current, admittance); QUANTITY_SPEC(susceptance, admittance); QUANTITY_SPEC(modulus_of_admittance, admittance); diff --git a/src/systems/include/mp-units/systems/isq/light_and_radiation.h b/src/systems/include/mp-units/systems/isq/light_and_radiation.h index bb5b772db..bfca2dbfa 100644 --- a/src/systems/include/mp-units/systems/isq/light_and_radiation.h +++ b/src/systems/include/mp-units/systems/isq/light_and_radiation.h @@ -45,9 +45,9 @@ QUANTITY_SPEC(radiant_energy_density, radiant_energy / volume); QUANTITY_SPEC(spectral_radiant_energy_density_in_terms_of_wavelength, radiant_energy_density / wavelength); QUANTITY_SPEC(spectral_radiant_energy_density_in_terms_of_wavenumber, radiant_energy_density / wavenumber); QUANTITY_SPEC(radiant_flux, power, radiant_energy / time); -constexpr auto radiant_power = radiant_flux; +inline constexpr auto radiant_power = radiant_flux; QUANTITY_SPEC(spectral_radiant_flux, radiant_flux / wavelength); -constexpr auto spectral_radiant_power = spectral_radiant_flux; +inline constexpr auto spectral_radiant_power = spectral_radiant_flux; QUANTITY_SPEC(radiant_intensity, radiant_flux / solid_angular_measure); QUANTITY_SPEC(spectral_radiant_intensity, radiant_intensity / wavelength); QUANTITY_SPEC(radiance, radiant_intensity / area); diff --git a/src/systems/include/mp-units/systems/isq/mechanics.h b/src/systems/include/mp-units/systems/isq/mechanics.h index 4de542322..411571434 100644 --- a/src/systems/include/mp-units/systems/isq/mechanics.h +++ b/src/systems/include/mp-units/systems/isq/mechanics.h @@ -37,24 +37,24 @@ MP_UNITS_EXPORT namespace mp_units::isq { QUANTITY_SPEC(mass_density, mass / volume); -constexpr auto density = mass_density; +inline constexpr auto density = mass_density; QUANTITY_SPEC(specific_volume, inverse(mass_density)); QUANTITY_SPEC(relative_mass_density, mass_density / mass_density); -constexpr auto relative_density = relative_mass_density; +inline constexpr auto relative_density = relative_mass_density; QUANTITY_SPEC(surface_mass_density, mass / area); -constexpr auto surface_density = surface_mass_density; +inline constexpr auto surface_density = surface_mass_density; QUANTITY_SPEC(linear_mass_density, mass / length); -constexpr auto linear_density = linear_mass_density; +inline constexpr auto linear_density = linear_mass_density; QUANTITY_SPEC(momentum, mass* velocity); // vector QUANTITY_SPEC(force, mass* acceleration); // vector // TODO what is a correct equation here? QUANTITY_SPEC(weight, force, mass* acceleration_of_free_fall); // vector // differs from ISO 80000 QUANTITY_SPEC(static_friction_force, force); // vector -constexpr auto static_friction = static_friction_force; +inline constexpr auto static_friction = static_friction_force; QUANTITY_SPEC(kinetic_friction_force, force); // vector -constexpr auto dynamic_friction_force = kinetic_friction_force; +inline constexpr auto dynamic_friction_force = kinetic_friction_force; QUANTITY_SPEC(rolling_resistance, force); // vector -constexpr auto rolling_drag = rolling_resistance; -constexpr auto rolling_friction_force = rolling_resistance; +inline constexpr auto rolling_drag = rolling_resistance; +inline constexpr auto rolling_friction_force = rolling_resistance; QUANTITY_SPEC(drag_force, force); // vector QUANTITY_SPEC(impulse, force* time); // vector QUANTITY_SPEC(angular_momentum, position_vector* momentum); // vector @@ -73,24 +73,24 @@ QUANTITY_SPEC(shear_strain, dimensionless, displacement / thickness, quantity_ch QUANTITY_SPEC(relative_volume_strain, volume / volume); QUANTITY_SPEC(Poisson_number, dimensionless, width / length); QUANTITY_SPEC(modulus_of_elasticity, normal_stress / relative_linear_strain); -constexpr auto Young_modulus = modulus_of_elasticity; +inline constexpr auto Young_modulus = modulus_of_elasticity; QUANTITY_SPEC(modulus_of_rigidity, shear_stress / shear_strain); -constexpr auto shear_modulus = modulus_of_rigidity; +inline constexpr auto shear_modulus = modulus_of_rigidity; QUANTITY_SPEC(modulus_of_compression, pressure / relative_volume_strain); -constexpr auto bulk_modulus = modulus_of_compression; +inline constexpr auto bulk_modulus = modulus_of_compression; QUANTITY_SPEC(compressibility, inverse(volume) * (volume / pressure)); QUANTITY_SPEC(second_axial_moment_of_area, pow<2>(radial_distance) * area); QUANTITY_SPEC(second_polar_moment_of_area, pow<2>(radial_distance) * area); QUANTITY_SPEC(section_modulus, second_axial_moment_of_area / radial_distance); QUANTITY_SPEC(static_friction_coefficient, dimensionless, static_friction_force / force, quantity_character::scalar); -constexpr auto static_friction_factor = static_friction_coefficient; -constexpr auto coefficient_of_static_friction = static_friction_coefficient; +inline constexpr auto static_friction_factor = static_friction_coefficient; +inline constexpr auto coefficient_of_static_friction = static_friction_coefficient; QUANTITY_SPEC(kinetic_friction_factor, dimensionless, kinetic_friction_force / force, quantity_character::scalar); -constexpr auto dynamic_friction_factor = kinetic_friction_factor; +inline constexpr auto dynamic_friction_factor = kinetic_friction_factor; QUANTITY_SPEC(rolling_resistance_factor, force / force, quantity_character::scalar); QUANTITY_SPEC(drag_coefficient, dimensionless, drag_force / (mass_density * pow<2>(speed) * area), quantity_character::scalar); -constexpr auto drag_factor = drag_coefficient; +inline constexpr auto drag_factor = drag_coefficient; QUANTITY_SPEC(dynamic_viscosity, shear_stress* length / velocity, quantity_character::scalar); QUANTITY_SPEC(kinematic_viscosity, dynamic_viscosity / mass_density); QUANTITY_SPEC(surface_tension, force / length, quantity_character::scalar); // TODO what is a correct equation here? @@ -100,7 +100,7 @@ QUANTITY_SPEC(mechanical_energy, energy); // diffe QUANTITY_SPEC(potential_energy, mechanical_energy); // differs from ISO 80000 QUANTITY_SPEC(kinetic_energy, mechanical_energy, mass* pow<2>(speed)); // differs from ISO 80000 QUANTITY_SPEC(mechanical_work, force* displacement, quantity_character::scalar); -constexpr auto work = mechanical_work; +inline constexpr auto work = mechanical_work; QUANTITY_SPEC(mechanical_efficiency, mechanical_power / mechanical_power); QUANTITY_SPEC(mass_flow, mass_density* velocity); // vector QUANTITY_SPEC(mass_flow_rate, mass_flow* area, quantity_character::scalar); diff --git a/src/systems/include/mp-units/systems/isq/si_quantities.h b/src/systems/include/mp-units/systems/isq/si_quantities.h index a8b66c272..9486c3e31 100644 --- a/src/systems/include/mp-units/systems/isq/si_quantities.h +++ b/src/systems/include/mp-units/systems/isq/si_quantities.h @@ -37,15 +37,15 @@ namespace mp_units::isq { // space and time QUANTITY_SPEC(width, length); -constexpr auto breadth = width; +inline constexpr auto breadth = width; QUANTITY_SPEC(radius, width); // differs from ISO 80000 QUANTITY_SPEC(path_length, length); -constexpr auto arc_length = path_length; +inline constexpr auto arc_length = path_length; QUANTITY_SPEC(area, pow<2>(length)); QUANTITY_SPEC(angular_measure, dimensionless, arc_length / radius, is_kind); QUANTITY_SPEC(solid_angular_measure, dimensionless, area / pow<2>(radius), is_kind); QUANTITY_SPEC(period_duration, duration); -constexpr auto period = period_duration; +inline constexpr auto period = period_duration; QUANTITY_SPEC(frequency, inverse(period_duration)); // mechanics diff --git a/src/systems/include/mp-units/systems/isq/space_and_time.h b/src/systems/include/mp-units/systems/isq/space_and_time.h index d24db1360..2157a299b 100644 --- a/src/systems/include/mp-units/systems/isq/space_and_time.h +++ b/src/systems/include/mp-units/systems/isq/space_and_time.h @@ -36,8 +36,8 @@ MP_UNITS_EXPORT namespace mp_units::isq { QUANTITY_SPEC(height, length); -constexpr auto depth = height; -constexpr auto altitude = height; +inline constexpr auto depth = height; +inline constexpr auto altitude = height; QUANTITY_SPEC(thickness, width); QUANTITY_SPEC(diameter, width); QUANTITY_SPEC(distance, path_length); @@ -48,7 +48,7 @@ QUANTITY_SPEC(radius_of_curvature, radius); QUANTITY_SPEC(curvature, inverse(radius_of_curvature)); QUANTITY_SPEC(volume, pow<3>(length)); QUANTITY_SPEC(rotational_displacement, angular_measure, path_length / radius); -constexpr auto angular_displacement = rotational_displacement; +inline constexpr auto angular_displacement = rotational_displacement; QUANTITY_SPEC(phase_angle, angular_measure); QUANTITY_SPEC(speed, length / time); // differs from ISO 80000 QUANTITY_SPEC(velocity, speed, position_vector / duration); // vector // differs from ISO 80000 @@ -62,18 +62,18 @@ QUANTITY_SPEC(rotational_frequency, rotation / duration); QUANTITY_SPEC(angular_frequency, phase_angle / duration); QUANTITY_SPEC(wavelength, length); QUANTITY_SPEC(repetency, inverse(wavelength)); -constexpr auto wavenumber = repetency; +inline constexpr auto wavenumber = repetency; QUANTITY_SPEC(wave_vector, repetency, quantity_character::vector); QUANTITY_SPEC(angular_repetency, inverse(wavelength)); -constexpr auto angular_wavenumber = angular_repetency; +inline constexpr auto angular_wavenumber = angular_repetency; QUANTITY_SPEC(phase_velocity, angular_frequency / angular_repetency); -constexpr auto phase_speed = phase_velocity; +inline constexpr auto phase_speed = phase_velocity; QUANTITY_SPEC(group_velocity, angular_frequency / angular_repetency); -constexpr auto group_speed = group_velocity; +inline constexpr auto group_speed = group_velocity; QUANTITY_SPEC(damping_coefficient, inverse(time_constant)); QUANTITY_SPEC(logarithmic_decrement, dimensionless, damping_coefficient* period_duration); QUANTITY_SPEC(attenuation, inverse(distance)); -constexpr auto extinction = attenuation; +inline constexpr auto extinction = attenuation; QUANTITY_SPEC(phase_coefficient, phase_angle / path_length); QUANTITY_SPEC(propagation_coefficient, inverse(length)); // γ = α + iβ where α denotes attenuation // and β the phase coefficient of a plane wave diff --git a/src/systems/include/mp-units/systems/isq/thermodynamics.h b/src/systems/include/mp-units/systems/isq/thermodynamics.h index f5b72d902..aed8edf96 100644 --- a/src/systems/include/mp-units/systems/isq/thermodynamics.h +++ b/src/systems/include/mp-units/systems/isq/thermodynamics.h @@ -46,7 +46,7 @@ QUANTITY_SPEC(isothermal_compressibility, inverse(volume) * (volume / pressure)) QUANTITY_SPEC(isentropic_compressibility, inverse(volume) * (volume / pressure)); // TODO how to handle "negative" part // energy definition moved to mechanics QUANTITY_SPEC(heat, energy); -constexpr auto amount_of_heat = heat; +inline constexpr auto amount_of_heat = heat; QUANTITY_SPEC(latent_heat, heat); // TODO what is a correct equation here? QUANTITY_SPEC(heat_flow_rate, heat / time); QUANTITY_SPEC(density_of_heat_flow_rate, heat_flow_rate / area); @@ -54,7 +54,7 @@ QUANTITY_SPEC(thermal_conductivity, density_of_heat_flow_rate*(length / thermody QUANTITY_SPEC(coefficient_of_heat_transfer, density_of_heat_flow_rate / thermodynamic_temperature); QUANTITY_SPEC(surface_coefficient_of_heat_transfer, density_of_heat_flow_rate / thermodynamic_temperature); QUANTITY_SPEC(thermal_insulance, inverse(coefficient_of_heat_transfer)); -constexpr auto coefficient_of_thermal_insulance = thermal_insulance; +inline constexpr auto coefficient_of_thermal_insulance = thermal_insulance; QUANTITY_SPEC(thermal_resistance, thermodynamic_temperature / heat_flow_rate); QUANTITY_SPEC(thermal_conductance, inverse(thermal_resistance)); QUANTITY_SPEC(heat_capacity, heat / thermodynamic_temperature); @@ -67,24 +67,24 @@ QUANTITY_SPEC(ratio_of_specific_heat_capacities, dimensionless, specific_heat_capacity_at_constant_pressure / specific_heat_capacity_at_constant_volume); QUANTITY_SPEC(isentropic_exponent, volume / pressure * (pressure / volume)); // TODO how to handle "negative" part -constexpr auto isentropic_expansion_factor = isentropic_exponent; +inline constexpr auto isentropic_expansion_factor = isentropic_exponent; QUANTITY_SPEC(entropy, kinetic_energy / thermodynamic_temperature); QUANTITY_SPEC(specific_entropy, entropy / mass); QUANTITY_SPEC(enthalpy, energy); // differs from ISO 80000 QUANTITY_SPEC(internal_energy, enthalpy); // differs from ISO 80000 -constexpr auto thermodynamic_energy = internal_energy; +inline constexpr auto thermodynamic_energy = internal_energy; QUANTITY_SPEC(Helmholtz_energy, internal_energy); -constexpr auto Helmholtz_function = Helmholtz_energy; +inline constexpr auto Helmholtz_function = Helmholtz_energy; QUANTITY_SPEC(Gibbs_energy, enthalpy); -constexpr auto Gibbs_function = Gibbs_energy; +inline constexpr auto Gibbs_function = Gibbs_energy; QUANTITY_SPEC(specific_energy, energy / mass); QUANTITY_SPEC(specific_internal_energy, internal_energy / mass); -constexpr auto specific_thermodynamic_energy = specific_internal_energy; +inline constexpr auto specific_thermodynamic_energy = specific_internal_energy; QUANTITY_SPEC(specific_enthalpy, enthalpy / mass); QUANTITY_SPEC(specific_Helmholtz_energy, Helmholtz_energy / mass); -constexpr auto specific_Helmholtz_function = specific_Helmholtz_energy; +inline constexpr auto specific_Helmholtz_function = specific_Helmholtz_energy; QUANTITY_SPEC(specific_Gibbs_energy, Gibbs_energy / mass); -constexpr auto specific_Gibbs_function = specific_Gibbs_energy; +inline constexpr auto specific_Gibbs_function = specific_Gibbs_energy; QUANTITY_SPEC(Massieu_function, Helmholtz_energy / thermodynamic_temperature); // TODO how to handle "negative" part QUANTITY_SPEC(Planck_function, Gibbs_energy / thermodynamic_temperature); // TODO how to handle "negative" part QUANTITY_SPEC(Joule_Thomson_coefficient, thermodynamic_temperature / pressure); diff --git a/src/systems/include/mp-units/systems/isq_angle.h b/src/systems/include/mp-units/systems/isq_angle.h index 69584b940..bf306d937 100644 --- a/src/systems/include/mp-units/systems/isq_angle.h +++ b/src/systems/include/mp-units/systems/isq_angle.h @@ -43,7 +43,7 @@ using namespace isq; QUANTITY_SPEC(cotes_angle_constant, angular::angle); // 1 rad QUANTITY_SPEC(angular_measure, angular::angle, cotes_angle_constant* arc_length / radius); QUANTITY_SPEC(rotational_displacement, angular::angle, cotes_angle_constant* path_length / radius); -constexpr auto angular_displacement = rotational_displacement; +inline constexpr auto angular_displacement = rotational_displacement; QUANTITY_SPEC(phase_angle, angular_measure); QUANTITY_SPEC(solid_angular_measure, pow<2>(cotes_angle_constant) * area / pow<2>(radius)); QUANTITY_SPEC(angular_velocity, angular_displacement / duration, quantity_character::vector); @@ -51,7 +51,7 @@ QUANTITY_SPEC(angular_acceleration, angular_velocity / duration); QUANTITY_SPEC(rotation, rotational_displacement); QUANTITY_SPEC(angular_frequency, phase_angle / duration); QUANTITY_SPEC(angular_repetency, cotes_angle_constant / wavelength); -constexpr auto angular_wavenumber = angular_repetency; +inline constexpr auto angular_wavenumber = angular_repetency; QUANTITY_SPEC(phase_coefficient, phase_angle / path_length); QUANTITY_SPEC(propagation_coefficient, cotes_angle_constant / length); QUANTITY_SPEC(angular_momentum, position_vector* momentum / cotes_angle_constant); // vector @@ -62,6 +62,6 @@ QUANTITY_SPEC(angular_impulse, moment_of_force* time); // vector QUANTITY_SPEC(loss_angle, angular_measure); // constants -constexpr auto cotes_angle = cotes_angle_constant[angular::radian]; +inline constexpr auto cotes_angle = cotes_angle_constant[angular::radian]; } // namespace mp_units::isq_angle diff --git a/src/systems/include/mp-units/systems/natural.h b/src/systems/include/mp-units/systems/natural.h index 23faf2db0..b5a65b63b 100644 --- a/src/systems/include/mp-units/systems/natural.h +++ b/src/systems/include/mp-units/systems/natural.h @@ -38,28 +38,28 @@ namespace mp_units::natural { // clang-format off // units -constexpr struct electronvolt final : named_unit<"eV"> {} electronvolt; -constexpr auto gigaelectronvolt = si::giga; +inline constexpr struct electronvolt final : named_unit<"eV"> {} electronvolt; +inline constexpr auto gigaelectronvolt = si::giga; // system references -constexpr struct time : system_reference {} time; -constexpr struct length : system_reference {} length; -constexpr struct mass : system_reference {} mass; -constexpr struct velocity : system_reference {} velocity; -constexpr struct speed : system_reference {} speed; -constexpr struct acceleration : system_reference {} acceleration; -constexpr struct momentum : system_reference {} momentum; -constexpr struct force : system_reference {} force; -constexpr struct energy : system_reference {} energy; +inline constexpr struct time : system_reference {} time; +inline constexpr struct length : system_reference {} length; +inline constexpr struct mass : system_reference {} mass; +inline constexpr struct velocity : system_reference {} velocity; +inline constexpr struct speed : system_reference {} speed; +inline constexpr struct acceleration : system_reference {} acceleration; +inline constexpr struct momentum : system_reference {} momentum; +inline constexpr struct force : system_reference {} force; +inline constexpr struct energy : system_reference {} energy; // clang-format on // constants -constexpr auto speed_of_light = speed[one]; +inline constexpr auto speed_of_light = speed[one]; namespace unit_symbols { -constexpr auto GeV = gigaelectronvolt; -constexpr auto GeV2 = square(gigaelectronvolt); +inline constexpr auto GeV = gigaelectronvolt; +inline constexpr auto GeV2 = square(gigaelectronvolt); } // namespace unit_symbols diff --git a/src/systems/include/mp-units/systems/si/constants.h b/src/systems/include/mp-units/systems/si/constants.h index 0e47105a8..a43c871c6 100644 --- a/src/systems/include/mp-units/systems/si/constants.h +++ b/src/systems/include/mp-units/systems/si/constants.h @@ -35,28 +35,28 @@ namespace mp_units::si { namespace si2019 { // clang-format off -constexpr struct hyperfine_structure_transition_frequency_of_cs final : +inline constexpr struct hyperfine_structure_transition_frequency_of_cs final : named_unit * hertz> {} hyperfine_structure_transition_frequency_of_cs; -constexpr struct speed_of_light_in_vacuum final : +inline constexpr struct speed_of_light_in_vacuum final : named_unit<"c", mag<299'792'458> * metre / second> {} speed_of_light_in_vacuum; -constexpr struct planck_constant final : +inline constexpr struct planck_constant final : named_unit<"h", mag_ratio<662'607'015, 100'000'000> * mag_power<10, -34> * joule * second> {} planck_constant; -constexpr struct elementary_charge final : +inline constexpr struct elementary_charge final : named_unit<"e", mag_ratio<1'602'176'634, 1'000'000'000> * mag_power<10, -19> * coulomb> {} elementary_charge; -constexpr struct boltzmann_constant final : +inline constexpr struct boltzmann_constant final : named_unit<"k", mag_ratio<1'380'649, 1'000'000> * mag_power<10, -23> * joule / kelvin> {} boltzmann_constant; -constexpr struct avogadro_constant final : +inline constexpr struct avogadro_constant final : named_unit<"N_A", mag_ratio<602'214'076, 100'000'000> * mag_power<10, 23> / mole> {} avogadro_constant; -constexpr struct luminous_efficacy final : +inline constexpr struct luminous_efficacy final : named_unit<"K_cd", mag<683> * lumen / watt> {} luminous_efficacy; // clang-format on } // namespace si2019 // clang-format off -constexpr struct standard_gravity final : +inline constexpr struct standard_gravity final : named_unit * metre / square(second)> {} standard_gravity; -constexpr struct magnetic_constant final : +inline constexpr struct magnetic_constant final : named_unit * mag_pi * mag_power<10, -7> * henry / metre> {} magnetic_constant; // clang-format on diff --git a/src/systems/include/mp-units/systems/si/unit_symbols.h b/src/systems/include/mp-units/systems/si/unit_symbols.h index ce5e68d89..466c956ce 100644 --- a/src/systems/include/mp-units/systems/si/unit_symbols.h +++ b/src/systems/include/mp-units/systems/si/unit_symbols.h @@ -31,774 +31,774 @@ namespace mp_units { namespace si::unit_symbols { -constexpr auto qm = quecto; -constexpr auto rm = ronto; -constexpr auto ym = yocto; -constexpr auto zm = zepto; -constexpr auto am = atto; -constexpr auto fm = femto; -constexpr auto pm = pico; -constexpr auto nm = nano; -constexpr auto um = micro; -constexpr auto mm = milli; -constexpr auto cm = centi; -constexpr auto dm = deci; -constexpr auto m = metre; -constexpr auto dam = deca; -constexpr auto hm = hecto; -constexpr auto km = kilo; -constexpr auto Mm = mega; -constexpr auto Gm = giga; -constexpr auto Tm = tera; -constexpr auto Pm = peta; -constexpr auto Em = exa; -constexpr auto Zm = zetta; -constexpr auto Ym = yotta; -constexpr auto Rm = ronna; -constexpr auto Qm = quetta; - -constexpr auto qs = quecto; -constexpr auto rs = ronto; -constexpr auto ys = yocto; -constexpr auto zs = zepto; -constexpr auto as = atto; -constexpr auto fs = femto; -constexpr auto ps = pico; -constexpr auto ns = nano; -constexpr auto us = micro; -constexpr auto ms = milli; -constexpr auto cs = centi; -constexpr auto ds = deci; -constexpr auto s = second; +inline constexpr auto qm = quecto; +inline constexpr auto rm = ronto; +inline constexpr auto ym = yocto; +inline constexpr auto zm = zepto; +inline constexpr auto am = atto; +inline constexpr auto fm = femto; +inline constexpr auto pm = pico; +inline constexpr auto nm = nano; +inline constexpr auto um = micro; +inline constexpr auto mm = milli; +inline constexpr auto cm = centi; +inline constexpr auto dm = deci; +inline constexpr auto m = metre; +inline constexpr auto dam = deca; +inline constexpr auto hm = hecto; +inline constexpr auto km = kilo; +inline constexpr auto Mm = mega; +inline constexpr auto Gm = giga; +inline constexpr auto Tm = tera; +inline constexpr auto Pm = peta; +inline constexpr auto Em = exa; +inline constexpr auto Zm = zetta; +inline constexpr auto Ym = yotta; +inline constexpr auto Rm = ronna; +inline constexpr auto Qm = quetta; + +inline constexpr auto qs = quecto; +inline constexpr auto rs = ronto; +inline constexpr auto ys = yocto; +inline constexpr auto zs = zepto; +inline constexpr auto as = atto; +inline constexpr auto fs = femto; +inline constexpr auto ps = pico; +inline constexpr auto ns = nano; +inline constexpr auto us = micro; +inline constexpr auto ms = milli; +inline constexpr auto cs = centi; +inline constexpr auto ds = deci; +inline constexpr auto s = second; // TODO Should the below multiples of second be provided? -constexpr auto das = deca; -constexpr auto hs = hecto; -constexpr auto ks = kilo; -constexpr auto Ms = mega; -constexpr auto Gs = giga; -constexpr auto Ts = tera; -constexpr auto Ps = peta; -constexpr auto Es = exa; -constexpr auto Zs = zetta; -constexpr auto Ys = yotta; -constexpr auto Rs = ronna; -constexpr auto Qs = quetta; - -constexpr auto qg = quecto; -constexpr auto rg = ronto; -constexpr auto yg = yocto; -constexpr auto zg = zepto; -constexpr auto ag = atto; -constexpr auto fg = femto; -constexpr auto pg = pico; -constexpr auto ng = nano; -constexpr auto ug = micro; -constexpr auto mg = milli; -constexpr auto cg = centi; -constexpr auto dg = deci; -constexpr auto g = gram; -constexpr auto dag = deca; -constexpr auto hg = hecto; -constexpr auto kg = kilogram; -constexpr auto Mg = mega; -constexpr auto Gg = giga; -constexpr auto Tg = tera; -constexpr auto Pg = peta; -constexpr auto Eg = exa; -constexpr auto Zg = zetta; -constexpr auto Yg = yotta; -constexpr auto Rg = ronna; -constexpr auto Qg = quetta; - -constexpr auto qA = quecto; -constexpr auto rA = ronto; -constexpr auto yA = yocto; -constexpr auto zA = zepto; -constexpr auto aA = atto; -constexpr auto fA = femto; -constexpr auto pA = pico; -constexpr auto nA = nano; -constexpr auto uA = micro; -constexpr auto mA = milli; -constexpr auto cA = centi; -constexpr auto dA = deci; -constexpr auto A = ampere; -constexpr auto daA = deca; -constexpr auto hA = hecto; -constexpr auto kA = kilo; -constexpr auto MA = mega; -constexpr auto GA = giga; -constexpr auto TA = tera; -constexpr auto PA = peta; -constexpr auto EA = exa; -constexpr auto ZA = zetta; -constexpr auto YA = yotta; -constexpr auto RA = ronna; -constexpr auto QA = quetta; - -constexpr auto qK = quecto; -constexpr auto rK = ronto; -constexpr auto yK = yocto; -constexpr auto zK = zepto; -constexpr auto aK = atto; -constexpr auto fK = femto; -constexpr auto pK = pico; -constexpr auto nK = nano; -constexpr auto uK = micro; -constexpr auto mK = milli; -constexpr auto cK = centi; -constexpr auto dK = deci; -constexpr auto K = kelvin; -constexpr auto daK = deca; -constexpr auto hK = hecto; -constexpr auto kK = kilo; -constexpr auto MK = mega; -constexpr auto GK = giga; -constexpr auto TK = tera; -constexpr auto PK = peta; -constexpr auto EK = exa; -constexpr auto ZK = zetta; -constexpr auto YK = yotta; -constexpr auto RK = ronna; -constexpr auto QK = quetta; - -constexpr auto qmol = quecto; -constexpr auto rmol = ronto; -constexpr auto ymol = yocto; -constexpr auto zmol = zepto; -constexpr auto amol = atto; -constexpr auto fmol = femto; -constexpr auto pmol = pico; -constexpr auto nmol = nano; -constexpr auto umol = micro; -constexpr auto mmol = milli; -constexpr auto cmol = centi; -constexpr auto dmol = deci; -constexpr auto mol = mole; -constexpr auto damol = deca; -constexpr auto hmol = hecto; -constexpr auto kmol = kilo; -constexpr auto Mmol = mega; -constexpr auto Gmol = giga; -constexpr auto Tmol = tera; -constexpr auto Pmol = peta; -constexpr auto Emol = exa; -constexpr auto Zmol = zetta; -constexpr auto Ymol = yotta; -constexpr auto Rmol = ronna; -constexpr auto Qmol = quetta; - -constexpr auto qcd = quecto; -constexpr auto rcd = ronto; -constexpr auto ycd = yocto; -constexpr auto zcd = zepto; -constexpr auto acd = atto; -constexpr auto fcd = femto; -constexpr auto pcd = pico; -constexpr auto ncd = nano; -constexpr auto ucd = micro; -constexpr auto mcd = milli; -constexpr auto ccd = centi; -constexpr auto dcd = deci; -constexpr auto cd = candela; -constexpr auto dacd = deca; -constexpr auto hcd = hecto; -constexpr auto kcd = kilo; -constexpr auto Mcd = mega; -constexpr auto Gcd = giga; -constexpr auto Tcd = tera; -constexpr auto Pcd = peta; -constexpr auto Ecd = exa; -constexpr auto Zcd = zetta; -constexpr auto Ycd = yotta; -constexpr auto Rcd = ronna; -constexpr auto Qcd = quetta; - -constexpr auto qrad = quecto; -constexpr auto rrad = ronto; -constexpr auto yrad = yocto; -constexpr auto zrad = zepto; -constexpr auto arad = atto; -constexpr auto frad = femto; -constexpr auto prad = pico; -constexpr auto nrad = nano; -constexpr auto urad = micro; -constexpr auto mrad = milli; -constexpr auto crad = centi; -constexpr auto drad = deci; -constexpr auto rad = radian; -constexpr auto darad = deca; -constexpr auto hrad = hecto; -constexpr auto krad = kilo; -constexpr auto Mrad = mega; -constexpr auto Grad = giga; -constexpr auto Trad = tera; -constexpr auto Prad = peta; -constexpr auto Erad = exa; -constexpr auto Zrad = zetta; -constexpr auto Yrad = yotta; -constexpr auto Rrad = ronna; -constexpr auto Qrad = quetta; - -constexpr auto qsr = quecto; -constexpr auto rsr = ronto; -constexpr auto ysr = yocto; -constexpr auto zsr = zepto; -constexpr auto asr = atto; -constexpr auto fsr = femto; -constexpr auto psr = pico; -constexpr auto nsr = nano; -constexpr auto usr = micro; -constexpr auto msr = milli; -constexpr auto csr = centi; -constexpr auto dsr = deci; -constexpr auto sr = steradian; -constexpr auto dasr = deca; -constexpr auto hsr = hecto; -constexpr auto ksr = kilo; -constexpr auto Msr = mega; -constexpr auto Gsr = giga; -constexpr auto Tsr = tera; -constexpr auto Psr = peta; -constexpr auto Esr = exa; -constexpr auto Zsr = zetta; -constexpr auto Ysr = yotta; -constexpr auto Rsr = ronna; -constexpr auto Qsr = quetta; - -constexpr auto qHz = quecto; -constexpr auto rHz = ronto; -constexpr auto yHz = yocto; -constexpr auto zHz = zepto; -constexpr auto aHz = atto; -constexpr auto fHz = femto; -constexpr auto pHz = pico; -constexpr auto nHz = nano; -constexpr auto uHz = micro; -constexpr auto mHz = milli; -constexpr auto cHz = centi; -constexpr auto dHz = deci; -constexpr auto Hz = hertz; -constexpr auto daHz = deca; -constexpr auto hHz = hecto; -constexpr auto kHz = kilo; -constexpr auto MHz = mega; -constexpr auto GHz = giga; -constexpr auto THz = tera; -constexpr auto PHz = peta; -constexpr auto EHz = exa; -constexpr auto ZHz = zetta; -constexpr auto YHz = yotta; -constexpr auto RHz = ronna; -constexpr auto QHz = quetta; - -constexpr auto qN = quecto; -constexpr auto rN = ronto; -constexpr auto yN = yocto; -constexpr auto zN = zepto; -constexpr auto aN = atto; -constexpr auto fN = femto; -constexpr auto pN = pico; -constexpr auto nN = nano; -constexpr auto uN = micro; -constexpr auto mN = milli; -constexpr auto cN = centi; -constexpr auto dN = deci; -constexpr auto N = newton; -constexpr auto daN = deca; -constexpr auto hN = hecto; -constexpr auto kN = kilo; -constexpr auto MN = mega; -constexpr auto GN = giga; -constexpr auto TN = tera; -constexpr auto PN = peta; -constexpr auto EN = exa; -constexpr auto ZN = zetta; -constexpr auto YN = yotta; -constexpr auto RN = ronna; -constexpr auto QN = quetta; +inline constexpr auto das = deca; +inline constexpr auto hs = hecto; +inline constexpr auto ks = kilo; +inline constexpr auto Ms = mega; +inline constexpr auto Gs = giga; +inline constexpr auto Ts = tera; +inline constexpr auto Ps = peta; +inline constexpr auto Es = exa; +inline constexpr auto Zs = zetta; +inline constexpr auto Ys = yotta; +inline constexpr auto Rs = ronna; +inline constexpr auto Qs = quetta; + +inline constexpr auto qg = quecto; +inline constexpr auto rg = ronto; +inline constexpr auto yg = yocto; +inline constexpr auto zg = zepto; +inline constexpr auto ag = atto; +inline constexpr auto fg = femto; +inline constexpr auto pg = pico; +inline constexpr auto ng = nano; +inline constexpr auto ug = micro; +inline constexpr auto mg = milli; +inline constexpr auto cg = centi; +inline constexpr auto dg = deci; +inline constexpr auto g = gram; +inline constexpr auto dag = deca; +inline constexpr auto hg = hecto; +inline constexpr auto kg = kilogram; +inline constexpr auto Mg = mega; +inline constexpr auto Gg = giga; +inline constexpr auto Tg = tera; +inline constexpr auto Pg = peta; +inline constexpr auto Eg = exa; +inline constexpr auto Zg = zetta; +inline constexpr auto Yg = yotta; +inline constexpr auto Rg = ronna; +inline constexpr auto Qg = quetta; + +inline constexpr auto qA = quecto; +inline constexpr auto rA = ronto; +inline constexpr auto yA = yocto; +inline constexpr auto zA = zepto; +inline constexpr auto aA = atto; +inline constexpr auto fA = femto; +inline constexpr auto pA = pico; +inline constexpr auto nA = nano; +inline constexpr auto uA = micro; +inline constexpr auto mA = milli; +inline constexpr auto cA = centi; +inline constexpr auto dA = deci; +inline constexpr auto A = ampere; +inline constexpr auto daA = deca; +inline constexpr auto hA = hecto; +inline constexpr auto kA = kilo; +inline constexpr auto MA = mega; +inline constexpr auto GA = giga; +inline constexpr auto TA = tera; +inline constexpr auto PA = peta; +inline constexpr auto EA = exa; +inline constexpr auto ZA = zetta; +inline constexpr auto YA = yotta; +inline constexpr auto RA = ronna; +inline constexpr auto QA = quetta; + +inline constexpr auto qK = quecto; +inline constexpr auto rK = ronto; +inline constexpr auto yK = yocto; +inline constexpr auto zK = zepto; +inline constexpr auto aK = atto; +inline constexpr auto fK = femto; +inline constexpr auto pK = pico; +inline constexpr auto nK = nano; +inline constexpr auto uK = micro; +inline constexpr auto mK = milli; +inline constexpr auto cK = centi; +inline constexpr auto dK = deci; +inline constexpr auto K = kelvin; +inline constexpr auto daK = deca; +inline constexpr auto hK = hecto; +inline constexpr auto kK = kilo; +inline constexpr auto MK = mega; +inline constexpr auto GK = giga; +inline constexpr auto TK = tera; +inline constexpr auto PK = peta; +inline constexpr auto EK = exa; +inline constexpr auto ZK = zetta; +inline constexpr auto YK = yotta; +inline constexpr auto RK = ronna; +inline constexpr auto QK = quetta; + +inline constexpr auto qmol = quecto; +inline constexpr auto rmol = ronto; +inline constexpr auto ymol = yocto; +inline constexpr auto zmol = zepto; +inline constexpr auto amol = atto; +inline constexpr auto fmol = femto; +inline constexpr auto pmol = pico; +inline constexpr auto nmol = nano; +inline constexpr auto umol = micro; +inline constexpr auto mmol = milli; +inline constexpr auto cmol = centi; +inline constexpr auto dmol = deci; +inline constexpr auto mol = mole; +inline constexpr auto damol = deca; +inline constexpr auto hmol = hecto; +inline constexpr auto kmol = kilo; +inline constexpr auto Mmol = mega; +inline constexpr auto Gmol = giga; +inline constexpr auto Tmol = tera; +inline constexpr auto Pmol = peta; +inline constexpr auto Emol = exa; +inline constexpr auto Zmol = zetta; +inline constexpr auto Ymol = yotta; +inline constexpr auto Rmol = ronna; +inline constexpr auto Qmol = quetta; + +inline constexpr auto qcd = quecto; +inline constexpr auto rcd = ronto; +inline constexpr auto ycd = yocto; +inline constexpr auto zcd = zepto; +inline constexpr auto acd = atto; +inline constexpr auto fcd = femto; +inline constexpr auto pcd = pico; +inline constexpr auto ncd = nano; +inline constexpr auto ucd = micro; +inline constexpr auto mcd = milli; +inline constexpr auto ccd = centi; +inline constexpr auto dcd = deci; +inline constexpr auto cd = candela; +inline constexpr auto dacd = deca; +inline constexpr auto hcd = hecto; +inline constexpr auto kcd = kilo; +inline constexpr auto Mcd = mega; +inline constexpr auto Gcd = giga; +inline constexpr auto Tcd = tera; +inline constexpr auto Pcd = peta; +inline constexpr auto Ecd = exa; +inline constexpr auto Zcd = zetta; +inline constexpr auto Ycd = yotta; +inline constexpr auto Rcd = ronna; +inline constexpr auto Qcd = quetta; + +inline constexpr auto qrad = quecto; +inline constexpr auto rrad = ronto; +inline constexpr auto yrad = yocto; +inline constexpr auto zrad = zepto; +inline constexpr auto arad = atto; +inline constexpr auto frad = femto; +inline constexpr auto prad = pico; +inline constexpr auto nrad = nano; +inline constexpr auto urad = micro; +inline constexpr auto mrad = milli; +inline constexpr auto crad = centi; +inline constexpr auto drad = deci; +inline constexpr auto rad = radian; +inline constexpr auto darad = deca; +inline constexpr auto hrad = hecto; +inline constexpr auto krad = kilo; +inline constexpr auto Mrad = mega; +inline constexpr auto Grad = giga; +inline constexpr auto Trad = tera; +inline constexpr auto Prad = peta; +inline constexpr auto Erad = exa; +inline constexpr auto Zrad = zetta; +inline constexpr auto Yrad = yotta; +inline constexpr auto Rrad = ronna; +inline constexpr auto Qrad = quetta; + +inline constexpr auto qsr = quecto; +inline constexpr auto rsr = ronto; +inline constexpr auto ysr = yocto; +inline constexpr auto zsr = zepto; +inline constexpr auto asr = atto; +inline constexpr auto fsr = femto; +inline constexpr auto psr = pico; +inline constexpr auto nsr = nano; +inline constexpr auto usr = micro; +inline constexpr auto msr = milli; +inline constexpr auto csr = centi; +inline constexpr auto dsr = deci; +inline constexpr auto sr = steradian; +inline constexpr auto dasr = deca; +inline constexpr auto hsr = hecto; +inline constexpr auto ksr = kilo; +inline constexpr auto Msr = mega; +inline constexpr auto Gsr = giga; +inline constexpr auto Tsr = tera; +inline constexpr auto Psr = peta; +inline constexpr auto Esr = exa; +inline constexpr auto Zsr = zetta; +inline constexpr auto Ysr = yotta; +inline constexpr auto Rsr = ronna; +inline constexpr auto Qsr = quetta; + +inline constexpr auto qHz = quecto; +inline constexpr auto rHz = ronto; +inline constexpr auto yHz = yocto; +inline constexpr auto zHz = zepto; +inline constexpr auto aHz = atto; +inline constexpr auto fHz = femto; +inline constexpr auto pHz = pico; +inline constexpr auto nHz = nano; +inline constexpr auto uHz = micro; +inline constexpr auto mHz = milli; +inline constexpr auto cHz = centi; +inline constexpr auto dHz = deci; +inline constexpr auto Hz = hertz; +inline constexpr auto daHz = deca; +inline constexpr auto hHz = hecto; +inline constexpr auto kHz = kilo; +inline constexpr auto MHz = mega; +inline constexpr auto GHz = giga; +inline constexpr auto THz = tera; +inline constexpr auto PHz = peta; +inline constexpr auto EHz = exa; +inline constexpr auto ZHz = zetta; +inline constexpr auto YHz = yotta; +inline constexpr auto RHz = ronna; +inline constexpr auto QHz = quetta; + +inline constexpr auto qN = quecto; +inline constexpr auto rN = ronto; +inline constexpr auto yN = yocto; +inline constexpr auto zN = zepto; +inline constexpr auto aN = atto; +inline constexpr auto fN = femto; +inline constexpr auto pN = pico; +inline constexpr auto nN = nano; +inline constexpr auto uN = micro; +inline constexpr auto mN = milli; +inline constexpr auto cN = centi; +inline constexpr auto dN = deci; +inline constexpr auto N = newton; +inline constexpr auto daN = deca; +inline constexpr auto hN = hecto; +inline constexpr auto kN = kilo; +inline constexpr auto MN = mega; +inline constexpr auto GN = giga; +inline constexpr auto TN = tera; +inline constexpr auto PN = peta; +inline constexpr auto EN = exa; +inline constexpr auto ZN = zetta; +inline constexpr auto YN = yotta; +inline constexpr auto RN = ronna; +inline constexpr auto QN = quetta; #ifdef pascal #pragma push_macro("pascal") #undef pascal #define MP_UNITS_REDEFINE_PASCAL #endif -constexpr auto qPa = quecto; -constexpr auto rPa = ronto; -constexpr auto yPa = yocto; -constexpr auto zPa = zepto; -constexpr auto aPa = atto; -constexpr auto fPa = femto; -constexpr auto pPa = pico; -constexpr auto nPa = nano; -constexpr auto uPa = micro; -constexpr auto mPa = milli; -constexpr auto cPa = centi; -constexpr auto dPa = deci; -constexpr auto Pa = pascal; -constexpr auto daPa = deca; -constexpr auto hPa = hecto; -constexpr auto kPa = kilo; -constexpr auto MPa = mega; -constexpr auto GPa = giga; -constexpr auto TPa = tera; -constexpr auto PPa = peta; -constexpr auto EPa = exa; -constexpr auto ZPa = zetta; -constexpr auto YPa = yotta; -constexpr auto RPa = ronna; -constexpr auto QPa = quetta; +inline constexpr auto qPa = quecto; +inline constexpr auto rPa = ronto; +inline constexpr auto yPa = yocto; +inline constexpr auto zPa = zepto; +inline constexpr auto aPa = atto; +inline constexpr auto fPa = femto; +inline constexpr auto pPa = pico; +inline constexpr auto nPa = nano; +inline constexpr auto uPa = micro; +inline constexpr auto mPa = milli; +inline constexpr auto cPa = centi; +inline constexpr auto dPa = deci; +inline constexpr auto Pa = pascal; +inline constexpr auto daPa = deca; +inline constexpr auto hPa = hecto; +inline constexpr auto kPa = kilo; +inline constexpr auto MPa = mega; +inline constexpr auto GPa = giga; +inline constexpr auto TPa = tera; +inline constexpr auto PPa = peta; +inline constexpr auto EPa = exa; +inline constexpr auto ZPa = zetta; +inline constexpr auto YPa = yotta; +inline constexpr auto RPa = ronna; +inline constexpr auto QPa = quetta; #ifdef MP_UNITS_REDEFINE_PASCAL #pragma pop_macro("pascal") #undef MP_UNITS_REDEFINE_PASCAL #endif -constexpr auto qJ = quecto; -constexpr auto rJ = ronto; -constexpr auto yJ = yocto; -constexpr auto zJ = zepto; -constexpr auto aJ = atto; -constexpr auto fJ = femto; -constexpr auto pJ = pico; -constexpr auto nJ = nano; -constexpr auto uJ = micro; -constexpr auto mJ = milli; -constexpr auto cJ = centi; -constexpr auto dJ = deci; -constexpr auto J = joule; -constexpr auto daJ = deca; -constexpr auto hJ = hecto; -constexpr auto kJ = kilo; -constexpr auto MJ = mega; -constexpr auto GJ = giga; -constexpr auto TJ = tera; -constexpr auto PJ = peta; -constexpr auto EJ = exa; -constexpr auto ZJ = zetta; -constexpr auto YJ = yotta; -constexpr auto RJ = ronna; -constexpr auto QJ = quetta; - -constexpr auto qW = quecto; -constexpr auto rW = ronto; -constexpr auto yW = yocto; -constexpr auto zW = zepto; -constexpr auto aW = atto; -constexpr auto fW = femto; -constexpr auto pW = pico; -constexpr auto nW = nano; -constexpr auto uW = micro; -constexpr auto mW = milli; -constexpr auto cW = centi; -constexpr auto dW = deci; -constexpr auto W = watt; -constexpr auto daW = deca; -constexpr auto hW = hecto; -constexpr auto kW = kilo; -constexpr auto MW = mega; -constexpr auto GW = giga; -constexpr auto TW = tera; -constexpr auto PW = peta; -constexpr auto EW = exa; -constexpr auto ZW = zetta; -constexpr auto YW = yotta; -constexpr auto RW = ronna; -constexpr auto QW = quetta; - -constexpr auto qC = quecto; -constexpr auto rC = ronto; -constexpr auto yC = yocto; -constexpr auto zC = zepto; -constexpr auto aC = atto; -constexpr auto fC = femto; -constexpr auto pC = pico; -constexpr auto nC = nano; -constexpr auto uC = micro; -constexpr auto mC = milli; -constexpr auto cC = centi; -constexpr auto dC = deci; -constexpr auto C = coulomb; -constexpr auto daC = deca; -constexpr auto hC = hecto; -constexpr auto kC = kilo; -constexpr auto MC = mega; -constexpr auto GC = giga; -constexpr auto TC = tera; -constexpr auto PC = peta; -constexpr auto EC = exa; -constexpr auto ZC = zetta; -constexpr auto YC = yotta; -constexpr auto RC = ronna; -constexpr auto QC = quetta; - -constexpr auto qV = quecto; -constexpr auto rV = ronto; -constexpr auto yV = yocto; -constexpr auto zV = zepto; -constexpr auto aV = atto; -constexpr auto fV = femto; -constexpr auto pV = pico; -constexpr auto nV = nano; -constexpr auto uV = micro; -constexpr auto mV = milli; -constexpr auto cV = centi; -constexpr auto dV = deci; -constexpr auto V = volt; -constexpr auto daV = deca; -constexpr auto hV = hecto; -constexpr auto kV = kilo; -constexpr auto MV = mega; -constexpr auto GV = giga; -constexpr auto TV = tera; -constexpr auto PV = peta; -constexpr auto EV = exa; -constexpr auto ZV = zetta; -constexpr auto YV = yotta; -constexpr auto RV = ronna; -constexpr auto QV = quetta; - -constexpr auto qF = quecto; -constexpr auto rF = ronto; -constexpr auto yF = yocto; -constexpr auto zF = zepto; -constexpr auto aF = atto; -constexpr auto fF = femto; -constexpr auto pF = pico; -constexpr auto nF = nano; -constexpr auto uF = micro; -constexpr auto mF = milli; -constexpr auto cF = centi; -constexpr auto dF = deci; -constexpr auto F = farad; -constexpr auto daF = deca; -constexpr auto hF = hecto; -constexpr auto kF = kilo; -constexpr auto MF = mega; -constexpr auto GF = giga; -constexpr auto TF = tera; -constexpr auto PF = peta; -constexpr auto EF = exa; -constexpr auto ZF = zetta; -constexpr auto YF = yotta; -constexpr auto RF = ronna; -constexpr auto QF = quetta; - -constexpr auto qohm = quecto; -constexpr auto rohm = ronto; -constexpr auto yohm = yocto; -constexpr auto zohm = zepto; -constexpr auto aohm = atto; -constexpr auto fohm = femto; -constexpr auto pohm = pico; -constexpr auto nohm = nano; -constexpr auto uohm = micro; -constexpr auto mohm = milli; -constexpr auto cohm = centi; -constexpr auto dohm = deci; +inline constexpr auto qJ = quecto; +inline constexpr auto rJ = ronto; +inline constexpr auto yJ = yocto; +inline constexpr auto zJ = zepto; +inline constexpr auto aJ = atto; +inline constexpr auto fJ = femto; +inline constexpr auto pJ = pico; +inline constexpr auto nJ = nano; +inline constexpr auto uJ = micro; +inline constexpr auto mJ = milli; +inline constexpr auto cJ = centi; +inline constexpr auto dJ = deci; +inline constexpr auto J = joule; +inline constexpr auto daJ = deca; +inline constexpr auto hJ = hecto; +inline constexpr auto kJ = kilo; +inline constexpr auto MJ = mega; +inline constexpr auto GJ = giga; +inline constexpr auto TJ = tera; +inline constexpr auto PJ = peta; +inline constexpr auto EJ = exa; +inline constexpr auto ZJ = zetta; +inline constexpr auto YJ = yotta; +inline constexpr auto RJ = ronna; +inline constexpr auto QJ = quetta; + +inline constexpr auto qW = quecto; +inline constexpr auto rW = ronto; +inline constexpr auto yW = yocto; +inline constexpr auto zW = zepto; +inline constexpr auto aW = atto; +inline constexpr auto fW = femto; +inline constexpr auto pW = pico; +inline constexpr auto nW = nano; +inline constexpr auto uW = micro; +inline constexpr auto mW = milli; +inline constexpr auto cW = centi; +inline constexpr auto dW = deci; +inline constexpr auto W = watt; +inline constexpr auto daW = deca; +inline constexpr auto hW = hecto; +inline constexpr auto kW = kilo; +inline constexpr auto MW = mega; +inline constexpr auto GW = giga; +inline constexpr auto TW = tera; +inline constexpr auto PW = peta; +inline constexpr auto EW = exa; +inline constexpr auto ZW = zetta; +inline constexpr auto YW = yotta; +inline constexpr auto RW = ronna; +inline constexpr auto QW = quetta; + +inline constexpr auto qC = quecto; +inline constexpr auto rC = ronto; +inline constexpr auto yC = yocto; +inline constexpr auto zC = zepto; +inline constexpr auto aC = atto; +inline constexpr auto fC = femto; +inline constexpr auto pC = pico; +inline constexpr auto nC = nano; +inline constexpr auto uC = micro; +inline constexpr auto mC = milli; +inline constexpr auto cC = centi; +inline constexpr auto dC = deci; +inline constexpr auto C = coulomb; +inline constexpr auto daC = deca; +inline constexpr auto hC = hecto; +inline constexpr auto kC = kilo; +inline constexpr auto MC = mega; +inline constexpr auto GC = giga; +inline constexpr auto TC = tera; +inline constexpr auto PC = peta; +inline constexpr auto EC = exa; +inline constexpr auto ZC = zetta; +inline constexpr auto YC = yotta; +inline constexpr auto RC = ronna; +inline constexpr auto QC = quetta; + +inline constexpr auto qV = quecto; +inline constexpr auto rV = ronto; +inline constexpr auto yV = yocto; +inline constexpr auto zV = zepto; +inline constexpr auto aV = atto; +inline constexpr auto fV = femto; +inline constexpr auto pV = pico; +inline constexpr auto nV = nano; +inline constexpr auto uV = micro; +inline constexpr auto mV = milli; +inline constexpr auto cV = centi; +inline constexpr auto dV = deci; +inline constexpr auto V = volt; +inline constexpr auto daV = deca; +inline constexpr auto hV = hecto; +inline constexpr auto kV = kilo; +inline constexpr auto MV = mega; +inline constexpr auto GV = giga; +inline constexpr auto TV = tera; +inline constexpr auto PV = peta; +inline constexpr auto EV = exa; +inline constexpr auto ZV = zetta; +inline constexpr auto YV = yotta; +inline constexpr auto RV = ronna; +inline constexpr auto QV = quetta; + +inline constexpr auto qF = quecto; +inline constexpr auto rF = ronto; +inline constexpr auto yF = yocto; +inline constexpr auto zF = zepto; +inline constexpr auto aF = atto; +inline constexpr auto fF = femto; +inline constexpr auto pF = pico; +inline constexpr auto nF = nano; +inline constexpr auto uF = micro; +inline constexpr auto mF = milli; +inline constexpr auto cF = centi; +inline constexpr auto dF = deci; +inline constexpr auto F = farad; +inline constexpr auto daF = deca; +inline constexpr auto hF = hecto; +inline constexpr auto kF = kilo; +inline constexpr auto MF = mega; +inline constexpr auto GF = giga; +inline constexpr auto TF = tera; +inline constexpr auto PF = peta; +inline constexpr auto EF = exa; +inline constexpr auto ZF = zetta; +inline constexpr auto YF = yotta; +inline constexpr auto RF = ronna; +inline constexpr auto QF = quetta; + +inline constexpr auto qohm = quecto; +inline constexpr auto rohm = ronto; +inline constexpr auto yohm = yocto; +inline constexpr auto zohm = zepto; +inline constexpr auto aohm = atto; +inline constexpr auto fohm = femto; +inline constexpr auto pohm = pico; +inline constexpr auto nohm = nano; +inline constexpr auto uohm = micro; +inline constexpr auto mohm = milli; +inline constexpr auto cohm = centi; +inline constexpr auto dohm = deci; using si::ohm; -constexpr auto daohm = deca; -constexpr auto hohm = hecto; -constexpr auto kohm = kilo; -constexpr auto Mohm = mega; -constexpr auto Gohm = giga; -constexpr auto Tohm = tera; -constexpr auto Pohm = peta; -constexpr auto Eohm = exa; -constexpr auto Zohm = zetta; -constexpr auto Yohm = yotta; -constexpr auto Rohm = ronna; -constexpr auto Qohm = quetta; - -constexpr auto qS = quecto; -constexpr auto rS = ronto; -constexpr auto yS = yocto; -constexpr auto zS = zepto; -constexpr auto aS = atto; -constexpr auto fS = femto; -constexpr auto pS = pico; -constexpr auto nS = nano; -constexpr auto uS = micro; -constexpr auto mS = milli; -constexpr auto cS = centi; -constexpr auto dS = deci; -constexpr auto S = siemens; -constexpr auto daS = deca; -constexpr auto hS = hecto; -constexpr auto kS = kilo; -constexpr auto MS = mega; -constexpr auto GS = giga; -constexpr auto TS = tera; -constexpr auto PS = peta; -constexpr auto ES = exa; -constexpr auto ZS = zetta; -constexpr auto YS = yotta; -constexpr auto RS = ronna; -constexpr auto QS = quetta; - -constexpr auto qWb = quecto; -constexpr auto rWb = ronto; -constexpr auto yWb = yocto; -constexpr auto zWb = zepto; -constexpr auto aWb = atto; -constexpr auto fWb = femto; -constexpr auto pWb = pico; -constexpr auto nWb = nano; -constexpr auto uWb = micro; -constexpr auto mWb = milli; -constexpr auto cWb = centi; -constexpr auto dWb = deci; -constexpr auto Wb = weber; -constexpr auto daWb = deca; -constexpr auto hWb = hecto; -constexpr auto kWb = kilo; -constexpr auto MWb = mega; -constexpr auto GWb = giga; -constexpr auto TWb = tera; -constexpr auto PWb = peta; -constexpr auto EWb = exa; -constexpr auto ZWb = zetta; -constexpr auto YWb = yotta; -constexpr auto RWb = ronna; -constexpr auto QWb = quetta; - -constexpr auto qT = quecto; -constexpr auto rT = ronto; -constexpr auto yT = yocto; -constexpr auto zT = zepto; -constexpr auto aT = atto; -constexpr auto fT = femto; -constexpr auto pT = pico; -constexpr auto nT = nano; -constexpr auto uT = micro; -constexpr auto mT = milli; -constexpr auto cT = centi; -constexpr auto dT = deci; -constexpr auto T = tesla; -constexpr auto daT = deca; -constexpr auto hT = hecto; -constexpr auto kT = kilo; -constexpr auto MT = mega; -constexpr auto GT = giga; -constexpr auto TT = tera; -constexpr auto PT = peta; -constexpr auto ET = exa; -constexpr auto ZT = zetta; -constexpr auto YT = yotta; -constexpr auto RT = ronna; -constexpr auto QT = quetta; - -constexpr auto qH = quecto; -constexpr auto rH = ronto; -constexpr auto yH = yocto; -constexpr auto zH = zepto; -constexpr auto aH = atto; -constexpr auto fH = femto; -constexpr auto pH = pico; -constexpr auto nH = nano; -constexpr auto uH = micro; -constexpr auto mH = milli; -constexpr auto cH = centi; -constexpr auto dH = deci; -constexpr auto H = henry; -constexpr auto daH = deca; -constexpr auto hH = hecto; -constexpr auto kH = kilo; -constexpr auto MH = mega; -constexpr auto GH = giga; -constexpr auto TH = tera; -constexpr auto PH = peta; -constexpr auto EH = exa; -constexpr auto ZH = zetta; -constexpr auto YH = yotta; -constexpr auto RH = ronna; -constexpr auto QH = quetta; - -constexpr auto qlm = quecto; -constexpr auto rlm = ronto; -constexpr auto ylm = yocto; -constexpr auto zlm = zepto; -constexpr auto alm = atto; -constexpr auto flm = femto; -constexpr auto plm = pico; -constexpr auto nlm = nano; -constexpr auto ulm = micro; -constexpr auto mlm = milli; -constexpr auto clm = centi; -constexpr auto dlm = deci; -constexpr auto lm = lumen; -constexpr auto dalm = deca; -constexpr auto hlm = hecto; -constexpr auto klm = kilo; -constexpr auto Mlm = mega; -constexpr auto Glm = giga; -constexpr auto Tlm = tera; -constexpr auto Plm = peta; -constexpr auto Elm = exa; -constexpr auto Zlm = zetta; -constexpr auto Ylm = yotta; -constexpr auto Rlm = ronna; -constexpr auto Qlm = quetta; - -constexpr auto qlx = quecto; -constexpr auto rlx = ronto; -constexpr auto ylx = yocto; -constexpr auto zlx = zepto; -constexpr auto alx = atto; -constexpr auto flx = femto; -constexpr auto plx = pico; -constexpr auto nlx = nano; -constexpr auto ulx = micro; -constexpr auto mlx = milli; -constexpr auto clx = centi; -constexpr auto dlx = deci; -constexpr auto lx = lux; -constexpr auto dalx = deca; -constexpr auto hlx = hecto; -constexpr auto klx = kilo; -constexpr auto Mlx = mega; -constexpr auto Glx = giga; -constexpr auto Tlx = tera; -constexpr auto Plx = peta; -constexpr auto Elx = exa; -constexpr auto Zlx = zetta; -constexpr auto Ylx = yotta; -constexpr auto Rlx = ronna; -constexpr auto Qlx = quetta; - -constexpr auto qBq = quecto; -constexpr auto rBq = ronto; -constexpr auto yBq = yocto; -constexpr auto zBq = zepto; -constexpr auto aBq = atto; -constexpr auto fBq = femto; -constexpr auto pBq = pico; -constexpr auto nBq = nano; -constexpr auto uBq = micro; -constexpr auto mBq = milli; -constexpr auto cBq = centi; -constexpr auto dBq = deci; -constexpr auto Bq = becquerel; -constexpr auto daBq = deca; -constexpr auto hBq = hecto; -constexpr auto kBq = kilo; -constexpr auto MBq = mega; -constexpr auto GBq = giga; -constexpr auto TBq = tera; -constexpr auto PBq = peta; -constexpr auto EBq = exa; -constexpr auto ZBq = zetta; -constexpr auto YBq = yotta; -constexpr auto RBq = ronna; -constexpr auto QBq = quetta; - -constexpr auto qGy = quecto; -constexpr auto rGy = ronto; -constexpr auto yGy = yocto; -constexpr auto zGy = zepto; -constexpr auto aGy = atto; -constexpr auto fGy = femto; -constexpr auto pGy = pico; -constexpr auto nGy = nano; -constexpr auto uGy = micro; -constexpr auto mGy = milli; -constexpr auto cGy = centi; -constexpr auto dGy = deci; -constexpr auto Gy = gray; -constexpr auto daGy = deca; -constexpr auto hGy = hecto; -constexpr auto kGy = kilo; -constexpr auto MGy = mega; -constexpr auto GGy = giga; -constexpr auto TGy = tera; -constexpr auto PGy = peta; -constexpr auto EGy = exa; -constexpr auto ZGy = zetta; -constexpr auto YGy = yotta; -constexpr auto RGy = ronna; -constexpr auto QGy = quetta; - -constexpr auto qSv = quecto; -constexpr auto rSv = ronto; -constexpr auto ySv = yocto; -constexpr auto zSv = zepto; -constexpr auto aSv = atto; -constexpr auto fSv = femto; -constexpr auto pSv = pico; -constexpr auto nSv = nano; -constexpr auto uSv = micro; -constexpr auto mSv = milli; -constexpr auto cSv = centi; -constexpr auto dSv = deci; -constexpr auto Sv = sievert; -constexpr auto daSv = deca; -constexpr auto hSv = hecto; -constexpr auto kSv = kilo; -constexpr auto MSv = mega; -constexpr auto GSv = giga; -constexpr auto TSv = tera; -constexpr auto PSv = peta; -constexpr auto ESv = exa; -constexpr auto ZSv = zetta; -constexpr auto YSv = yotta; -constexpr auto RSv = ronna; -constexpr auto QSv = quetta; - -constexpr auto qkat = quecto; -constexpr auto rkat = ronto; -constexpr auto ykat = yocto; -constexpr auto zkat = zepto; -constexpr auto akat = atto; -constexpr auto fkat = femto; -constexpr auto pkat = pico; -constexpr auto nkat = nano; -constexpr auto ukat = micro; -constexpr auto mkat = milli; -constexpr auto ckat = centi; -constexpr auto dkat = deci; -constexpr auto kat = katal; -constexpr auto dakat = deca; -constexpr auto hkat = hecto; -constexpr auto kkat = kilo; -constexpr auto Mkat = mega; -constexpr auto Gkat = giga; -constexpr auto Tkat = tera; -constexpr auto Pkat = peta; -constexpr auto Ekat = exa; -constexpr auto Zkat = zetta; -constexpr auto Ykat = yotta; -constexpr auto Rkat = ronna; -constexpr auto Qkat = quetta; +inline constexpr auto daohm = deca; +inline constexpr auto hohm = hecto; +inline constexpr auto kohm = kilo; +inline constexpr auto Mohm = mega; +inline constexpr auto Gohm = giga; +inline constexpr auto Tohm = tera; +inline constexpr auto Pohm = peta; +inline constexpr auto Eohm = exa; +inline constexpr auto Zohm = zetta; +inline constexpr auto Yohm = yotta; +inline constexpr auto Rohm = ronna; +inline constexpr auto Qohm = quetta; + +inline constexpr auto qS = quecto; +inline constexpr auto rS = ronto; +inline constexpr auto yS = yocto; +inline constexpr auto zS = zepto; +inline constexpr auto aS = atto; +inline constexpr auto fS = femto; +inline constexpr auto pS = pico; +inline constexpr auto nS = nano; +inline constexpr auto uS = micro; +inline constexpr auto mS = milli; +inline constexpr auto cS = centi; +inline constexpr auto dS = deci; +inline constexpr auto S = siemens; +inline constexpr auto daS = deca; +inline constexpr auto hS = hecto; +inline constexpr auto kS = kilo; +inline constexpr auto MS = mega; +inline constexpr auto GS = giga; +inline constexpr auto TS = tera; +inline constexpr auto PS = peta; +inline constexpr auto ES = exa; +inline constexpr auto ZS = zetta; +inline constexpr auto YS = yotta; +inline constexpr auto RS = ronna; +inline constexpr auto QS = quetta; + +inline constexpr auto qWb = quecto; +inline constexpr auto rWb = ronto; +inline constexpr auto yWb = yocto; +inline constexpr auto zWb = zepto; +inline constexpr auto aWb = atto; +inline constexpr auto fWb = femto; +inline constexpr auto pWb = pico; +inline constexpr auto nWb = nano; +inline constexpr auto uWb = micro; +inline constexpr auto mWb = milli; +inline constexpr auto cWb = centi; +inline constexpr auto dWb = deci; +inline constexpr auto Wb = weber; +inline constexpr auto daWb = deca; +inline constexpr auto hWb = hecto; +inline constexpr auto kWb = kilo; +inline constexpr auto MWb = mega; +inline constexpr auto GWb = giga; +inline constexpr auto TWb = tera; +inline constexpr auto PWb = peta; +inline constexpr auto EWb = exa; +inline constexpr auto ZWb = zetta; +inline constexpr auto YWb = yotta; +inline constexpr auto RWb = ronna; +inline constexpr auto QWb = quetta; + +inline constexpr auto qT = quecto; +inline constexpr auto rT = ronto; +inline constexpr auto yT = yocto; +inline constexpr auto zT = zepto; +inline constexpr auto aT = atto; +inline constexpr auto fT = femto; +inline constexpr auto pT = pico; +inline constexpr auto nT = nano; +inline constexpr auto uT = micro; +inline constexpr auto mT = milli; +inline constexpr auto cT = centi; +inline constexpr auto dT = deci; +inline constexpr auto T = tesla; +inline constexpr auto daT = deca; +inline constexpr auto hT = hecto; +inline constexpr auto kT = kilo; +inline constexpr auto MT = mega; +inline constexpr auto GT = giga; +inline constexpr auto TT = tera; +inline constexpr auto PT = peta; +inline constexpr auto ET = exa; +inline constexpr auto ZT = zetta; +inline constexpr auto YT = yotta; +inline constexpr auto RT = ronna; +inline constexpr auto QT = quetta; + +inline constexpr auto qH = quecto; +inline constexpr auto rH = ronto; +inline constexpr auto yH = yocto; +inline constexpr auto zH = zepto; +inline constexpr auto aH = atto; +inline constexpr auto fH = femto; +inline constexpr auto pH = pico; +inline constexpr auto nH = nano; +inline constexpr auto uH = micro; +inline constexpr auto mH = milli; +inline constexpr auto cH = centi; +inline constexpr auto dH = deci; +inline constexpr auto H = henry; +inline constexpr auto daH = deca; +inline constexpr auto hH = hecto; +inline constexpr auto kH = kilo; +inline constexpr auto MH = mega; +inline constexpr auto GH = giga; +inline constexpr auto TH = tera; +inline constexpr auto PH = peta; +inline constexpr auto EH = exa; +inline constexpr auto ZH = zetta; +inline constexpr auto YH = yotta; +inline constexpr auto RH = ronna; +inline constexpr auto QH = quetta; + +inline constexpr auto qlm = quecto; +inline constexpr auto rlm = ronto; +inline constexpr auto ylm = yocto; +inline constexpr auto zlm = zepto; +inline constexpr auto alm = atto; +inline constexpr auto flm = femto; +inline constexpr auto plm = pico; +inline constexpr auto nlm = nano; +inline constexpr auto ulm = micro; +inline constexpr auto mlm = milli; +inline constexpr auto clm = centi; +inline constexpr auto dlm = deci; +inline constexpr auto lm = lumen; +inline constexpr auto dalm = deca; +inline constexpr auto hlm = hecto; +inline constexpr auto klm = kilo; +inline constexpr auto Mlm = mega; +inline constexpr auto Glm = giga; +inline constexpr auto Tlm = tera; +inline constexpr auto Plm = peta; +inline constexpr auto Elm = exa; +inline constexpr auto Zlm = zetta; +inline constexpr auto Ylm = yotta; +inline constexpr auto Rlm = ronna; +inline constexpr auto Qlm = quetta; + +inline constexpr auto qlx = quecto; +inline constexpr auto rlx = ronto; +inline constexpr auto ylx = yocto; +inline constexpr auto zlx = zepto; +inline constexpr auto alx = atto; +inline constexpr auto flx = femto; +inline constexpr auto plx = pico; +inline constexpr auto nlx = nano; +inline constexpr auto ulx = micro; +inline constexpr auto mlx = milli; +inline constexpr auto clx = centi; +inline constexpr auto dlx = deci; +inline constexpr auto lx = lux; +inline constexpr auto dalx = deca; +inline constexpr auto hlx = hecto; +inline constexpr auto klx = kilo; +inline constexpr auto Mlx = mega; +inline constexpr auto Glx = giga; +inline constexpr auto Tlx = tera; +inline constexpr auto Plx = peta; +inline constexpr auto Elx = exa; +inline constexpr auto Zlx = zetta; +inline constexpr auto Ylx = yotta; +inline constexpr auto Rlx = ronna; +inline constexpr auto Qlx = quetta; + +inline constexpr auto qBq = quecto; +inline constexpr auto rBq = ronto; +inline constexpr auto yBq = yocto; +inline constexpr auto zBq = zepto; +inline constexpr auto aBq = atto; +inline constexpr auto fBq = femto; +inline constexpr auto pBq = pico; +inline constexpr auto nBq = nano; +inline constexpr auto uBq = micro; +inline constexpr auto mBq = milli; +inline constexpr auto cBq = centi; +inline constexpr auto dBq = deci; +inline constexpr auto Bq = becquerel; +inline constexpr auto daBq = deca; +inline constexpr auto hBq = hecto; +inline constexpr auto kBq = kilo; +inline constexpr auto MBq = mega; +inline constexpr auto GBq = giga; +inline constexpr auto TBq = tera; +inline constexpr auto PBq = peta; +inline constexpr auto EBq = exa; +inline constexpr auto ZBq = zetta; +inline constexpr auto YBq = yotta; +inline constexpr auto RBq = ronna; +inline constexpr auto QBq = quetta; + +inline constexpr auto qGy = quecto; +inline constexpr auto rGy = ronto; +inline constexpr auto yGy = yocto; +inline constexpr auto zGy = zepto; +inline constexpr auto aGy = atto; +inline constexpr auto fGy = femto; +inline constexpr auto pGy = pico; +inline constexpr auto nGy = nano; +inline constexpr auto uGy = micro; +inline constexpr auto mGy = milli; +inline constexpr auto cGy = centi; +inline constexpr auto dGy = deci; +inline constexpr auto Gy = gray; +inline constexpr auto daGy = deca; +inline constexpr auto hGy = hecto; +inline constexpr auto kGy = kilo; +inline constexpr auto MGy = mega; +inline constexpr auto GGy = giga; +inline constexpr auto TGy = tera; +inline constexpr auto PGy = peta; +inline constexpr auto EGy = exa; +inline constexpr auto ZGy = zetta; +inline constexpr auto YGy = yotta; +inline constexpr auto RGy = ronna; +inline constexpr auto QGy = quetta; + +inline constexpr auto qSv = quecto; +inline constexpr auto rSv = ronto; +inline constexpr auto ySv = yocto; +inline constexpr auto zSv = zepto; +inline constexpr auto aSv = atto; +inline constexpr auto fSv = femto; +inline constexpr auto pSv = pico; +inline constexpr auto nSv = nano; +inline constexpr auto uSv = micro; +inline constexpr auto mSv = milli; +inline constexpr auto cSv = centi; +inline constexpr auto dSv = deci; +inline constexpr auto Sv = sievert; +inline constexpr auto daSv = deca; +inline constexpr auto hSv = hecto; +inline constexpr auto kSv = kilo; +inline constexpr auto MSv = mega; +inline constexpr auto GSv = giga; +inline constexpr auto TSv = tera; +inline constexpr auto PSv = peta; +inline constexpr auto ESv = exa; +inline constexpr auto ZSv = zetta; +inline constexpr auto YSv = yotta; +inline constexpr auto RSv = ronna; +inline constexpr auto QSv = quetta; + +inline constexpr auto qkat = quecto; +inline constexpr auto rkat = ronto; +inline constexpr auto ykat = yocto; +inline constexpr auto zkat = zepto; +inline constexpr auto akat = atto; +inline constexpr auto fkat = femto; +inline constexpr auto pkat = pico; +inline constexpr auto nkat = nano; +inline constexpr auto ukat = micro; +inline constexpr auto mkat = milli; +inline constexpr auto ckat = centi; +inline constexpr auto dkat = deci; +inline constexpr auto kat = katal; +inline constexpr auto dakat = deca; +inline constexpr auto hkat = hecto; +inline constexpr auto kkat = kilo; +inline constexpr auto Mkat = mega; +inline constexpr auto Gkat = giga; +inline constexpr auto Tkat = tera; +inline constexpr auto Pkat = peta; +inline constexpr auto Ekat = exa; +inline constexpr auto Zkat = zetta; +inline constexpr auto Ykat = yotta; +inline constexpr auto Rkat = ronna; +inline constexpr auto Qkat = quetta; // no prefixes should be provided for the below units -constexpr auto deg_C = degree_Celsius; +inline constexpr auto deg_C = degree_Celsius; // commonly used squared and cubic units -constexpr auto m2 = square(metre); -constexpr auto m3 = cubic(metre); -constexpr auto m4 = pow<4>(metre); -constexpr auto s2 = square(second); -constexpr auto s3 = cubic(second); +inline constexpr auto m2 = square(metre); +inline constexpr auto m3 = cubic(metre); +inline constexpr auto m4 = pow<4>(metre); +inline constexpr auto s2 = square(second); +inline constexpr auto s3 = cubic(second); } // namespace si::unit_symbols namespace non_si::unit_symbols { // TODO Should the following non-SI units have prefixed symbols predefiend as well? -constexpr auto au = astronomical_unit; -constexpr auto deg = degree; -constexpr auto arcmin = arcminute; -constexpr auto arcsec = arcsecond; -constexpr auto a = are; -constexpr auto ha = hectare; -constexpr auto l = litre; -constexpr auto t = tonne; -constexpr auto Da = dalton; -constexpr auto eV = electronvolt; +inline constexpr auto au = astronomical_unit; +inline constexpr auto deg = degree; +inline constexpr auto arcmin = arcminute; +inline constexpr auto arcsec = arcsecond; +inline constexpr auto a = are; +inline constexpr auto ha = hectare; +inline constexpr auto l = litre; +inline constexpr auto t = tonne; +inline constexpr auto Da = dalton; +inline constexpr auto eV = electronvolt; // no prefixes should be provided for the below units -constexpr auto min = minute; -constexpr auto h = hour; -constexpr auto d = day; +inline constexpr auto min = minute; +inline constexpr auto h = hour; +inline constexpr auto d = day; } // namespace non_si::unit_symbols diff --git a/src/systems/include/mp-units/systems/si/units.h b/src/systems/include/mp-units/systems/si/units.h index 9b464c98c..856808784 100644 --- a/src/systems/include/mp-units/systems/si/units.h +++ b/src/systems/include/mp-units/systems/si/units.h @@ -39,55 +39,55 @@ namespace si { // clang-format off // base units -constexpr struct second final : named_unit<"s", kind_of> {} second; -constexpr struct metre final : named_unit<"m", kind_of> {} metre; -constexpr struct gram final : named_unit<"g", kind_of> {} gram; -constexpr auto kilogram = kilo; -constexpr struct ampere final : named_unit<"A", kind_of> {} ampere; +inline constexpr struct second final : named_unit<"s", kind_of> {} second; +inline constexpr struct metre final : named_unit<"m", kind_of> {} metre; +inline constexpr struct gram final : named_unit<"g", kind_of> {} gram; +inline constexpr auto kilogram = kilo; +inline constexpr struct ampere final : named_unit<"A", kind_of> {} ampere; -constexpr struct absolute_zero final : absolute_point_origin {} absolute_zero; -constexpr auto zeroth_kelvin = absolute_zero; -constexpr struct kelvin final : named_unit<"K", kind_of, zeroth_kelvin> {} kelvin; +inline constexpr struct absolute_zero final : absolute_point_origin {} absolute_zero; +inline constexpr auto zeroth_kelvin = absolute_zero; +inline constexpr struct kelvin final : named_unit<"K", kind_of, zeroth_kelvin> {} kelvin; -constexpr struct mole final : named_unit<"mol", kind_of> {} mole; -constexpr struct candela final : named_unit<"cd", kind_of> {} candela; +inline constexpr struct mole final : named_unit<"mol", kind_of> {} mole; +inline constexpr struct candela final : named_unit<"cd", kind_of> {} candela; // derived named units -constexpr struct radian final : named_unit<"rad", metre / metre, kind_of> {} radian; -constexpr struct steradian final : named_unit<"sr", square(metre) / square(metre), kind_of> {} steradian; -constexpr struct hertz final : named_unit<"Hz", one / second, kind_of> {} hertz; -constexpr struct newton final : named_unit<"N", kilogram * metre / square(second)> {} newton; +inline constexpr struct radian final : named_unit<"rad", metre / metre, kind_of> {} radian; +inline constexpr struct steradian final : named_unit<"sr", square(metre) / square(metre), kind_of> {} steradian; +inline constexpr struct hertz final : named_unit<"Hz", one / second, kind_of> {} hertz; +inline constexpr struct newton final : named_unit<"N", kilogram * metre / square(second)> {} newton; #ifdef pascal #pragma push_macro("pascal") #undef pascal #define MP_UNITS_REDEFINE_PASCAL #endif -constexpr struct pascal final : named_unit<"Pa", newton / square(metre)> {} pascal; +inline constexpr struct pascal final : named_unit<"Pa", newton / square(metre)> {} pascal; #ifdef MP_UNITS_REDEFINE_PASCAL #pragma pop_macro("pascal") #undef MP_UNITS_REDEFINE_PASCAL #endif -constexpr struct joule final : named_unit<"J", newton * metre> {} joule; -constexpr struct watt final : named_unit<"W", joule / second> {} watt; -constexpr struct coulomb final : named_unit<"C", ampere * second> {} coulomb; -constexpr struct volt final : named_unit<"V", watt / ampere> {} volt; -constexpr struct farad final : named_unit<"F", coulomb / volt> {} farad; -constexpr struct ohm final : named_unit {} ohm; -constexpr struct siemens final : named_unit<"S", one / ohm> {} siemens; -constexpr struct weber final : named_unit<"Wb", volt * second> {} weber; -constexpr struct tesla final : named_unit<"T", weber / square(metre)> {} tesla; -constexpr struct henry final : named_unit<"H", weber / ampere> {} henry; - -constexpr struct ice_point final : relative_point_origin>(273'150)> {} ice_point; -constexpr auto zeroth_degree_Celsius = ice_point; -constexpr struct degree_Celsius final : named_unit {} degree_Celsius; - -constexpr struct lumen final : named_unit<"lm", candela * steradian> {} lumen; -constexpr struct lux final : named_unit<"lx", lumen / square(metre)> {} lux; -constexpr struct becquerel final : named_unit<"Bq", one / second, kind_of> {} becquerel; -constexpr struct gray final : named_unit<"Gy", joule / kilogram, kind_of> {} gray; -constexpr struct sievert final : named_unit<"Sv", joule / kilogram, kind_of> {} sievert; -constexpr struct katal final : named_unit<"kat", mole / second> {} katal; +inline constexpr struct joule final : named_unit<"J", newton * metre> {} joule; +inline constexpr struct watt final : named_unit<"W", joule / second> {} watt; +inline constexpr struct coulomb final : named_unit<"C", ampere * second> {} coulomb; +inline constexpr struct volt final : named_unit<"V", watt / ampere> {} volt; +inline constexpr struct farad final : named_unit<"F", coulomb / volt> {} farad; +inline constexpr struct ohm final : named_unit {} ohm; +inline constexpr struct siemens final : named_unit<"S", one / ohm> {} siemens; +inline constexpr struct weber final : named_unit<"Wb", volt * second> {} weber; +inline constexpr struct tesla final : named_unit<"T", weber / square(metre)> {} tesla; +inline constexpr struct henry final : named_unit<"H", weber / ampere> {} henry; + +inline constexpr struct ice_point final : relative_point_origin>(273'150)> {} ice_point; +inline constexpr auto zeroth_degree_Celsius = ice_point; +inline constexpr struct degree_Celsius final : named_unit {} degree_Celsius; + +inline constexpr struct lumen final : named_unit<"lm", candela * steradian> {} lumen; +inline constexpr struct lux final : named_unit<"lx", lumen / square(metre)> {} lux; +inline constexpr struct becquerel final : named_unit<"Bq", one / second, kind_of> {} becquerel; +inline constexpr struct gray final : named_unit<"Gy", joule / kilogram, kind_of> {} gray; +inline constexpr struct sievert final : named_unit<"Sv", joule / kilogram, kind_of> {} sievert; +inline constexpr struct katal final : named_unit<"kat", mole / second> {} katal; // clang-format on } // namespace si @@ -96,20 +96,20 @@ namespace non_si { // clang-format off // non-SI units accepted for use with the SI -constexpr struct minute final : named_unit<"min", mag<60> * si::second> {} minute; -constexpr struct hour final : named_unit<"h", mag<60> * minute> {} hour; -constexpr struct day final : named_unit<"d", mag<24> * hour> {} day; -constexpr struct astronomical_unit final : named_unit<"au", mag<149'597'870'700> * si::metre> {} astronomical_unit; -constexpr struct degree final : named_unit * si::radian> {} degree; -constexpr struct arcminute final : named_unit * degree> {} arcminute; -constexpr struct arcsecond final : named_unit * arcminute> {} arcsecond; -constexpr struct are final : named_unit<"a", square(si::deca)> {} are; -constexpr auto hectare = si::hecto; -constexpr struct litre final : named_unit<"l", cubic(si::deci)> {} litre; -constexpr struct tonne final : named_unit<"t", mag<1000> * si::kilogram> {} tonne; -constexpr struct dalton final : named_unit<"Da", mag_ratio<16'605'390'666'050, 10'000'000'000'000> * mag_power<10, -27> * si::kilogram> {} dalton; +inline constexpr struct minute final : named_unit<"min", mag<60> * si::second> {} minute; +inline constexpr struct hour final : named_unit<"h", mag<60> * minute> {} hour; +inline constexpr struct day final : named_unit<"d", mag<24> * hour> {} day; +inline constexpr struct astronomical_unit final : named_unit<"au", mag<149'597'870'700> * si::metre> {} astronomical_unit; +inline constexpr struct degree final : named_unit * si::radian> {} degree; +inline constexpr struct arcminute final : named_unit * degree> {} arcminute; +inline constexpr struct arcsecond final : named_unit * arcminute> {} arcsecond; +inline constexpr struct are final : named_unit<"a", square(si::deca)> {} are; +inline constexpr auto hectare = si::hecto; +inline constexpr struct litre final : named_unit<"l", cubic(si::deci)> {} litre; +inline constexpr struct tonne final : named_unit<"t", mag<1000> * si::kilogram> {} tonne; +inline constexpr struct dalton final : named_unit<"Da", mag_ratio<16'605'390'666'050, 10'000'000'000'000> * mag_power<10, -27> * si::kilogram> {} dalton; // TODO A different value is provided in the SI Brochure and different in the ISO 80000 -constexpr struct electronvolt final : named_unit<"eV", mag_ratio<1'602'176'634, 1'000'000'000> * mag_power<10, -19> * si::joule> {} electronvolt; +inline constexpr struct electronvolt final : named_unit<"eV", mag_ratio<1'602'176'634, 1'000'000'000> * mag_power<10, -19> * si::joule> {} electronvolt; // TODO the below are logarithmic units - how to support those? // neper // bel diff --git a/src/systems/include/mp-units/systems/typographic.h b/src/systems/include/mp-units/systems/typographic.h index 6969d594d..f368d3502 100644 --- a/src/systems/include/mp-units/systems/typographic.h +++ b/src/systems/include/mp-units/systems/typographic.h @@ -36,11 +36,11 @@ namespace mp_units::typographic { // clang-format off // https://en.wikipedia.org/wiki/Point_(typography) -constexpr struct pica_us final : named_unit<"pica(us)", mag_ratio<166'044, 1'000'000> * international::inch> {} pica_us; -constexpr struct point_us final : named_unit<"point(us)", mag_ratio<1, 12> * pica_us> {} point_us; +inline constexpr struct pica_us final : named_unit<"pica(us)", mag_ratio<166'044, 1'000'000> * international::inch> {} pica_us; +inline constexpr struct point_us final : named_unit<"point(us)", mag_ratio<1, 12> * pica_us> {} point_us; -constexpr struct point_dtp final : named_unit<"point(dtp)", mag_ratio<1, 72> * international::inch> {} point_dtp; -constexpr struct pica_dtp final : named_unit<"pica(dtp)", mag<12> * point_dtp> {} pica_dtp; +inline constexpr struct point_dtp final : named_unit<"point(dtp)", mag_ratio<1, 72> * international::inch> {} point_dtp; +inline constexpr struct pica_dtp final : named_unit<"pica(dtp)", mag<12> * point_dtp> {} pica_dtp; // clang-format on } // namespace mp_units::typographic diff --git a/src/systems/include/mp-units/systems/usc.h b/src/systems/include/mp-units/systems/usc.h index 8214d7c43..cca91973d 100644 --- a/src/systems/include/mp-units/systems/usc.h +++ b/src/systems/include/mp-units/systems/usc.h @@ -41,78 +41,78 @@ using namespace international; // https://en.wikipedia.org/wiki/United_States_customary_units#Length // nautical -constexpr struct fathom final : named_unit<"ftm(us)", mag<2> * yard> {} fathom; -constexpr struct cable final : named_unit<"cb(us)", mag<120> * fathom> {} cable; +inline constexpr struct fathom final : named_unit<"ftm(us)", mag<2> * yard> {} fathom; +inline constexpr struct cable final : named_unit<"cb(us)", mag<120> * fathom> {} cable; // survey struct us_survey_foot final : named_unit<"ft(us)", mag_ratio<1'200, 3'937> * si::metre> {}; struct us_survey_mile final : named_unit<"mi(us)", mag<5280> * us_survey_foot{}> {}; [[deprecated("In accordance with NIST SP 811, as of January 1, 2023, the use of the U.S. survey foot and U.S. survey mile is deprecated.")]] -constexpr us_survey_foot us_survey_foot; +inline constexpr us_survey_foot us_survey_foot; [[deprecated("In accordance with NIST SP 811, as of January 1, 2023, the use of the U.S. survey foot and U.S. survey mile is deprecated.")]] -constexpr us_survey_mile us_survey_mile; +inline constexpr us_survey_mile us_survey_mile; -constexpr struct link final : named_unit<"li", mag_ratio<33, 50> * foot> {} link; -constexpr struct rod final : named_unit<"rd", mag<25> * link> {} rod; -constexpr struct chain final : named_unit<"ch", mag<4> * rod> {} chain; -constexpr struct furlong final : named_unit<"fur", mag<10> * chain> {} furlong; +inline constexpr struct link final : named_unit<"li", mag_ratio<33, 50> * foot> {} link; +inline constexpr struct rod final : named_unit<"rd", mag<25> * link> {} rod; +inline constexpr struct chain final : named_unit<"ch", mag<4> * rod> {} chain; +inline constexpr struct furlong final : named_unit<"fur", mag<10> * chain> {} furlong; // clang-format on namespace survey1893 { // clang-format off -constexpr struct us_survey_foot final : named_unit<"ft(us)", mag_ratio<1'200, 3'937> * si::metre> {} us_survey_foot; -constexpr struct link final : named_unit<"li", mag_ratio<33, 50> * us_survey_foot> {} link; -constexpr struct rod final : named_unit<"rd", mag<25> * link> {} rod; -constexpr struct chain final : named_unit<"ch", mag<4> * rod> {} chain; -constexpr struct furlong final : named_unit<"fur", mag<10> * chain> {} furlong; -constexpr struct us_survey_mile final : named_unit<"mi(us)", mag<8> * furlong> {} us_survey_mile; -constexpr struct league final : named_unit<"lea", mag<3> * us_survey_mile> {} league; +inline constexpr struct us_survey_foot final : named_unit<"ft(us)", mag_ratio<1'200, 3'937> * si::metre> {} us_survey_foot; +inline constexpr struct link final : named_unit<"li", mag_ratio<33, 50> * us_survey_foot> {} link; +inline constexpr struct rod final : named_unit<"rd", mag<25> * link> {} rod; +inline constexpr struct chain final : named_unit<"ch", mag<4> * rod> {} chain; +inline constexpr struct furlong final : named_unit<"fur", mag<10> * chain> {} furlong; +inline constexpr struct us_survey_mile final : named_unit<"mi(us)", mag<8> * furlong> {} us_survey_mile; +inline constexpr struct league final : named_unit<"lea", mag<3> * us_survey_mile> {} league; // clang-format on } // namespace survey1893 // clang-format off // https://en.wikipedia.org/wiki/United_States_customary_units#Area -constexpr struct acre final : named_unit<"acre", mag<10> * square(survey1893::chain)> {} acre; -constexpr struct section final : named_unit<"section", mag<640> * acre> {} section; +inline constexpr struct acre final : named_unit<"acre", mag<10> * square(survey1893::chain)> {} acre; +inline constexpr struct section final : named_unit<"section", mag<640> * acre> {} section; // https://en.wikipedia.org/wiki/United_States_customary_units#Fluid_volume -constexpr struct gallon final : named_unit<"gal", mag<231> * cubic(inch)> {} gallon; -constexpr struct pottle final : named_unit<"pot", mag_ratio<1, 2> * gallon> {} pottle; -constexpr struct quart final : named_unit<"qt", mag_ratio<1, 2> * pottle> {} quart; -constexpr struct pint final : named_unit<"pt", mag_ratio<1, 2> * quart> {} pint; -constexpr struct cup final : named_unit<"c", mag_ratio<1, 2> * pint> {} cup; -constexpr struct gill final : named_unit<"gi", mag_ratio<1, 2> * cup> {} gill; -constexpr struct fluid_ounce final : named_unit<"fl oz", mag_ratio<1, 4> * gill> {} fluid_ounce; -constexpr struct tablespoon final : named_unit<"tbsp", mag_ratio<1, 2> * fluid_ounce> {} tablespoon; -constexpr struct shot final : named_unit<"jig", mag<3> * tablespoon> {} shot; -constexpr struct teaspoon final : named_unit<"tsp", mag_ratio<1, 3> * tablespoon> {} teaspoon; -constexpr struct minim final : named_unit<"min", mag_ratio<1, 80> * teaspoon> {} minim; -constexpr struct fluid_dram final : named_unit<"fl dr", mag<60> * minim> {} fluid_dram; -constexpr struct barrel final : named_unit<"bbl", mag_ratio<315, 10> * gallon> {} barrel; -constexpr struct oil_barrel final : named_unit<"bbl", mag_ratio<4, 3> * barrel> {} oil_barrel; -constexpr struct hogshead final : named_unit<"hogshead", mag<63> * gallon> {} hogshead; +inline constexpr struct gallon final : named_unit<"gal", mag<231> * cubic(inch)> {} gallon; +inline constexpr struct pottle final : named_unit<"pot", mag_ratio<1, 2> * gallon> {} pottle; +inline constexpr struct quart final : named_unit<"qt", mag_ratio<1, 2> * pottle> {} quart; +inline constexpr struct pint final : named_unit<"pt", mag_ratio<1, 2> * quart> {} pint; +inline constexpr struct cup final : named_unit<"c", mag_ratio<1, 2> * pint> {} cup; +inline constexpr struct gill final : named_unit<"gi", mag_ratio<1, 2> * cup> {} gill; +inline constexpr struct fluid_ounce final : named_unit<"fl oz", mag_ratio<1, 4> * gill> {} fluid_ounce; +inline constexpr struct tablespoon final : named_unit<"tbsp", mag_ratio<1, 2> * fluid_ounce> {} tablespoon; +inline constexpr struct shot final : named_unit<"jig", mag<3> * tablespoon> {} shot; +inline constexpr struct teaspoon final : named_unit<"tsp", mag_ratio<1, 3> * tablespoon> {} teaspoon; +inline constexpr struct minim final : named_unit<"min", mag_ratio<1, 80> * teaspoon> {} minim; +inline constexpr struct fluid_dram final : named_unit<"fl dr", mag<60> * minim> {} fluid_dram; +inline constexpr struct barrel final : named_unit<"bbl", mag_ratio<315, 10> * gallon> {} barrel; +inline constexpr struct oil_barrel final : named_unit<"bbl", mag_ratio<4, 3> * barrel> {} oil_barrel; +inline constexpr struct hogshead final : named_unit<"hogshead", mag<63> * gallon> {} hogshead; // https://en.wikipedia.org/wiki/United_States_customary_units#Dry_volume -constexpr struct dry_barrel final : named_unit<"bbl", mag<7056> * cubic(inch)> {} dry_barrel; -constexpr struct bushel final : named_unit<"bu", mag_ratio<3'523'907'016'688, 100'000'000'000> * si::litre> {} bushel; -constexpr struct peck final : named_unit<"pk", mag_ratio<1, 4> * bushel> {} peck; -constexpr struct dry_gallon final : named_unit<"gal", mag_ratio<1, 2> * peck> {} dry_gallon; -constexpr struct dry_quart final : named_unit<"qt", mag_ratio<1, 4> * dry_gallon> {} dry_quart; -constexpr struct dry_pint final : named_unit<"pt", mag_ratio<1, 2> * dry_quart> {} dry_pint; +inline constexpr struct dry_barrel final : named_unit<"bbl", mag<7056> * cubic(inch)> {} dry_barrel; +inline constexpr struct bushel final : named_unit<"bu", mag_ratio<3'523'907'016'688, 100'000'000'000> * si::litre> {} bushel; +inline constexpr struct peck final : named_unit<"pk", mag_ratio<1, 4> * bushel> {} peck; +inline constexpr struct dry_gallon final : named_unit<"gal", mag_ratio<1, 2> * peck> {} dry_gallon; +inline constexpr struct dry_quart final : named_unit<"qt", mag_ratio<1, 4> * dry_gallon> {} dry_quart; +inline constexpr struct dry_pint final : named_unit<"pt", mag_ratio<1, 2> * dry_quart> {} dry_pint; // https://en.wikipedia.org/wiki/United_States_customary_units#Mass_and_Weight // https://en.wikipedia.org/wiki/Avoirdupois_system#American_customary_system -constexpr struct quarter final : named_unit<"qr", mag<25> * pound> {} quarter; -constexpr struct short_hundredweight final : named_unit<"cwt", mag<100> * pound> {} short_hundredweight; -constexpr struct ton final : named_unit<"t", mag<2'000> * pound> {} ton; -constexpr auto short_ton = ton; -constexpr struct pennyweight final : named_unit<"dwt", mag<24> * grain> {} pennyweight; -constexpr struct troy_once final : named_unit<"oz t", mag<20> * pennyweight> {} troy_once; -constexpr struct troy_pound final : named_unit<"lb t", mag<12> * troy_once> {} troy_pound; +inline constexpr struct quarter final : named_unit<"qr", mag<25> * pound> {} quarter; +inline constexpr struct short_hundredweight final : named_unit<"cwt", mag<100> * pound> {} short_hundredweight; +inline constexpr struct ton final : named_unit<"t", mag<2'000> * pound> {} ton; +inline constexpr auto short_ton = ton; +inline constexpr struct pennyweight final : named_unit<"dwt", mag<24> * grain> {} pennyweight; +inline constexpr struct troy_once final : named_unit<"oz t", mag<20> * pennyweight> {} troy_once; +inline constexpr struct troy_pound final : named_unit<"lb t", mag<12> * troy_once> {} troy_pound; // https://en.wikipedia.org/wiki/Inch_of_mercury #ifdef pascal @@ -120,15 +120,15 @@ constexpr struct troy_pound final : named_unit<"lb t", mag<12> * troy_once> {} t #undef pascal #define MP_UNITS_REDEFINE_PASCAL #endif -constexpr struct inch_of_mercury final : named_unit<"inHg", mag_ratio<3'386'389, 1'000> * si::pascal> {} inch_of_mercury; +inline constexpr struct inch_of_mercury final : named_unit<"inHg", mag_ratio<3'386'389, 1'000> * si::pascal> {} inch_of_mercury; #ifdef MP_UNITS_REDEFINE_PASCAL #pragma pop_macro("pascal") #undef MP_UNITS_REDEFINE_PASCAL #endif // https://en.wikipedia.org/wiki/United_States_customary_units#Temperature -constexpr struct zeroth_degree_Fahrenheit final : relative_point_origin * si::degree_Celsius>(-32)> {} zeroth_degree_Fahrenheit; -constexpr struct degree_Fahrenheit final : named_unit * si::degree_Celsius, zeroth_degree_Fahrenheit> {} degree_Fahrenheit; +inline constexpr struct zeroth_degree_Fahrenheit final : relative_point_origin * si::degree_Celsius>(-32)> {} zeroth_degree_Fahrenheit; +inline constexpr struct degree_Fahrenheit final : named_unit * si::degree_Celsius, zeroth_degree_Fahrenheit> {} degree_Fahrenheit; // clang-format on @@ -136,51 +136,51 @@ namespace unit_symbols { using namespace international::unit_symbols; -constexpr auto ftm = fathom; -constexpr auto cb = cable; +inline constexpr auto ftm = fathom; +inline constexpr auto cb = cable; [[deprecated( "In accordance with NIST SP 811, as of January 1, 2023, the use of the U.S. survey foot and U.S. survey mile is " - "deprecated.")]] constexpr struct us_survey_foot us_ft; + "deprecated.")]] inline constexpr struct us_survey_foot us_ft; [[deprecated( "In accordance with NIST SP 811, as of January 1, 2023, the use of the U.S. survey foot and U.S. survey mile is " - "deprecated.")]] constexpr struct us_survey_mile us_mi; -constexpr auto li = link; -constexpr auto rd = rod; -constexpr auto ch = chain; -constexpr auto fur = furlong; -constexpr auto lea = league; - -constexpr auto gal = gallon; -constexpr auto pot = pottle; -constexpr auto qt = quart; -constexpr auto pt = pint; -constexpr auto c = cup; -constexpr auto gi = gill; -constexpr auto fl_oz = fluid_ounce; -constexpr auto tbsp = tablespoon; -constexpr auto jig = shot; -constexpr auto tsp = teaspoon; -constexpr auto min = minim; -constexpr auto fl_dr = fluid_dram; -constexpr auto bbl = barrel; - -constexpr auto dry_bbl = dry_barrel; -constexpr auto bu = bushel; -constexpr auto pk = peck; -constexpr auto dry_gal = dry_gallon; -constexpr auto dry_qt = dry_quart; -constexpr auto dry_pt = dry_pint; - -constexpr auto qr = quarter; -constexpr auto cwt = short_hundredweight; -constexpr auto t = ton; -constexpr auto dwt = pennyweight; -constexpr auto oz_t = troy_once; -constexpr auto lb_t = troy_pound; - -constexpr auto inHg = inch_of_mercury; - -constexpr auto deg_F = degree_Fahrenheit; + "deprecated.")]] inline constexpr struct us_survey_mile us_mi; +inline constexpr auto li = link; +inline constexpr auto rd = rod; +inline constexpr auto ch = chain; +inline constexpr auto fur = furlong; +inline constexpr auto lea = league; + +inline constexpr auto gal = gallon; +inline constexpr auto pot = pottle; +inline constexpr auto qt = quart; +inline constexpr auto pt = pint; +inline constexpr auto c = cup; +inline constexpr auto gi = gill; +inline constexpr auto fl_oz = fluid_ounce; +inline constexpr auto tbsp = tablespoon; +inline constexpr auto jig = shot; +inline constexpr auto tsp = teaspoon; +inline constexpr auto min = minim; +inline constexpr auto fl_dr = fluid_dram; +inline constexpr auto bbl = barrel; + +inline constexpr auto dry_bbl = dry_barrel; +inline constexpr auto bu = bushel; +inline constexpr auto pk = peck; +inline constexpr auto dry_gal = dry_gallon; +inline constexpr auto dry_qt = dry_quart; +inline constexpr auto dry_pt = dry_pint; + +inline constexpr auto qr = quarter; +inline constexpr auto cwt = short_hundredweight; +inline constexpr auto t = ton; +inline constexpr auto dwt = pennyweight; +inline constexpr auto oz_t = troy_once; +inline constexpr auto lb_t = troy_pound; + +inline constexpr auto inHg = inch_of_mercury; + +inline constexpr auto deg_F = degree_Fahrenheit; } // namespace unit_symbols diff --git a/test/runtime/truncation_test.cpp b/test/runtime/truncation_test.cpp index 2626c5833..3ff100467 100644 --- a/test/runtime/truncation_test.cpp +++ b/test/runtime/truncation_test.cpp @@ -42,9 +42,9 @@ using namespace mp_units; using namespace mp_units::angular; using namespace mp_units::angular::unit_symbols; -constexpr struct half_revolution final : named_unit<"hrev", mag_pi * radian> { +inline constexpr struct half_revolution final : named_unit<"hrev", mag_pi * radian> { } half_revolution; -constexpr auto hrev = half_revolution; +inline constexpr auto hrev = half_revolution; // constexpr auto revb6 = mag_ratio<1,3> * mag_pi * rad; diff --git a/test/static/concepts_test.cpp b/test/static/concepts_test.cpp index 937776ebb..c67ff710e 100644 --- a/test/static/concepts_test.cpp +++ b/test/static/concepts_test.cpp @@ -44,12 +44,12 @@ namespace { using namespace mp_units; -constexpr struct my_origin final : absolute_point_origin { +inline constexpr struct my_origin final : absolute_point_origin { } my_origin; -constexpr struct my_relative_origin final : relative_point_origin { +inline constexpr struct my_relative_origin final : relative_point_origin { } my_relative_origin; -constexpr auto dim_speed = isq::dim_length / isq::dim_time; +inline constexpr auto dim_speed = isq::dim_length / isq::dim_time; // BaseDimension static_assert(detail::BaseDimension); @@ -78,7 +78,7 @@ static_assert(!Dimension); // TODO add tests // QuantitySpec -constexpr auto speed = isq::length / isq::time; +inline constexpr auto speed = isq::length / isq::time; static_assert(QuantitySpec); static_assert(QuantitySpec); diff --git a/test/static/dimension_test.cpp b/test/static/dimension_test.cpp index 6d4aa96f3..8064831eb 100644 --- a/test/static/dimension_test.cpp +++ b/test/static/dimension_test.cpp @@ -36,31 +36,31 @@ using namespace mp_units; using dimension_one_ = struct dimension_one; // clang-format off -constexpr struct length_ final : base_dimension<"L"> {} length; -constexpr struct mass_ final : base_dimension<"M"> {} mass; -constexpr struct time_ final : base_dimension<"T"> {} time; +inline constexpr struct length_ final : base_dimension<"L"> {} length; +inline constexpr struct mass_ final : base_dimension<"M"> {} mass; +inline constexpr struct time_ final : base_dimension<"T"> {} time; -constexpr auto my_length1 = length; -constexpr auto my_length2 = length; +inline constexpr auto my_length1 = length; +inline constexpr auto my_length2 = length; QUANTITY_SPEC_(q_time, time); -constexpr struct second_ final : named_unit<"s", kind_of> {} second; - -constexpr auto frequency = inverse(time); -constexpr auto action = inverse(time); -constexpr auto area = length * length; -constexpr auto volume = area * length; -constexpr auto speed = length / time; -constexpr auto acceleration = speed / time; -constexpr auto force = mass * acceleration; -constexpr auto moment_of_force = length * force; -constexpr auto torque = moment_of_force; -constexpr auto pressure = force / area; -constexpr auto stress = pressure; -constexpr auto strain = stress / stress; -constexpr auto power = force * speed; -constexpr auto efficiency = power / power; -constexpr auto energy = force * length; +inline constexpr struct second_ final : named_unit<"s", kind_of> {} second; + +inline constexpr auto frequency = inverse(time); +inline constexpr auto action = inverse(time); +inline constexpr auto area = length * length; +inline constexpr auto volume = area * length; +inline constexpr auto speed = length / time; +inline constexpr auto acceleration = speed / time; +inline constexpr auto force = mass * acceleration; +inline constexpr auto moment_of_force = length * force; +inline constexpr auto torque = moment_of_force; +inline constexpr auto pressure = force / area; +inline constexpr auto stress = pressure; +inline constexpr auto strain = stress / stress; +inline constexpr auto power = force * speed; +inline constexpr auto efficiency = power / power; +inline constexpr auto energy = force * length; // clang-format on // concepts verification diff --git a/test/static/magnitude_test.cpp b/test/static/magnitude_test.cpp index da2dd5cbd..ab82cbfc9 100644 --- a/test/static/magnitude_test.cpp +++ b/test/static/magnitude_test.cpp @@ -71,11 +71,11 @@ namespace { // CHECK(round_trip == R); // } -constexpr struct mag_2_ : magnitude<2> { +inline constexpr struct mag_2_ : magnitude<2> { } mag_2; -// constexpr struct mag_2_other : magnitude<2> { +// inline constexpr struct mag_2_other : magnitude<2> { // } mag_2_other; -// constexpr struct mag_3 : magnitude<2> { +// inline constexpr struct mag_3 : magnitude<2> { // } mag_3; // concepts verification diff --git a/test/static/quantity_point_test.cpp b/test/static/quantity_point_test.cpp index 80a35127a..f04e9c1ad 100644 --- a/test/static/quantity_point_test.cpp +++ b/test/static/quantity_point_test.cpp @@ -50,38 +50,38 @@ using namespace std::chrono_literals; using sys_seconds = std::chrono::time_point; #endif -constexpr struct zeroth_length final : absolute_point_origin { +inline constexpr struct zeroth_length final : absolute_point_origin { } zeroth_length; -constexpr struct mean_sea_level final : absolute_point_origin { +inline constexpr struct mean_sea_level final : absolute_point_origin { } mean_sea_level; -constexpr auto my_mean_sea_level = mean_sea_level; +inline constexpr auto my_mean_sea_level = mean_sea_level; -constexpr struct same_mean_sea_level final : relative_point_origin { +inline constexpr struct same_mean_sea_level final : relative_point_origin { } same_mean_sea_level; -constexpr struct ground_level final : relative_point_origin { +inline constexpr struct ground_level final : relative_point_origin { } ground_level; -constexpr auto my_ground_level = ground_level; +inline constexpr auto my_ground_level = ground_level; -constexpr struct same_ground_level1 final : relative_point_origin { +inline constexpr struct same_ground_level1 final : relative_point_origin { } same_ground_level1; -constexpr struct same_ground_level2 final : relative_point_origin { +inline constexpr struct same_ground_level2 final : relative_point_origin { } same_ground_level2; -constexpr struct tower_peak final : relative_point_origin { +inline constexpr struct tower_peak final : relative_point_origin { } tower_peak; -constexpr struct other_ground_level final : relative_point_origin { +inline constexpr struct other_ground_level final : relative_point_origin { } other_ground_level; -constexpr struct other_absolute_level final : absolute_point_origin { +inline constexpr struct other_absolute_level final : absolute_point_origin { } other_absolute_level; -constexpr struct zero final : absolute_point_origin { +inline constexpr struct zero final : absolute_point_origin { } zero; QUANTITY_SPEC(special_height, isq::height); @@ -122,7 +122,7 @@ static_assert(relative_po + isq::height(42 * m)>.quanti static_assert(relative_po> + isq::height(42 * m)>.quantity_spec == isq::height); static_assert(relative_po + 42 * m>.quantity_spec == isq::height); -constexpr struct my_kelvin final : named_unit<"my_K", mag<10> * si::kelvin> { +inline constexpr struct my_kelvin final : named_unit<"my_K", mag<10> * si::kelvin> { } my_kelvin; static_assert(default_point_origin(si::kelvin) == si::absolute_zero); @@ -1516,7 +1516,7 @@ static_assert(ground_level - other_ground_level == -81 * m); static_assert(other_ground_level - tower_peak == 39 * m); static_assert(tower_peak - other_ground_level == -39 * m); -constexpr struct zero_m_per_s final : absolute_point_origin> { +inline constexpr struct zero_m_per_s final : absolute_point_origin> { } zero_m_per_s; // commutativity and associativity @@ -1604,7 +1604,7 @@ static_assert( is_of_type, int>>); -constexpr struct zero_Hz final : absolute_point_origin> { +inline constexpr struct zero_Hz final : absolute_point_origin> { } zero_Hz; static_assert(((zero_Hz + 10 / (2 * isq::period_duration[s])) + 5 * isq::frequency[Hz]).quantity_from(zero_Hz) == @@ -1688,7 +1688,7 @@ consteval bool invalid_subtraction(Ts... ts) return !requires { (... - ts); }; } -constexpr struct zero_Bq final : absolute_point_origin> { +inline constexpr struct zero_Bq final : absolute_point_origin> { } zero_Bq; static_assert(invalid_addition(zero_Bq + 5 * isq::activity[Bq], 5 * isq::frequency[Hz])); diff --git a/test/static/quantity_spec_test.cpp b/test/static/quantity_spec_test.cpp index 8b5dc9909..ee4e86a8c 100644 --- a/test/static/quantity_spec_test.cpp +++ b/test/static/quantity_spec_test.cpp @@ -37,22 +37,22 @@ using dimensionless_ = struct dimensionless; using dim_one_ = struct dimension_one; // clang-format off -constexpr struct dim_length_ final : base_dimension<"L"> {} dim_length; -constexpr struct dim_mass_ final : base_dimension<"M"> {} dim_mass; -constexpr struct dim_time_ final : base_dimension<"T"> {} dim_time; +inline constexpr struct dim_length_ final : base_dimension<"L"> {} dim_length; +inline constexpr struct dim_mass_ final : base_dimension<"M"> {} dim_mass; +inline constexpr struct dim_time_ final : base_dimension<"T"> {} dim_time; // quantities specification QUANTITY_SPEC_(length, dim_length); QUANTITY_SPEC_(mass, dim_mass); QUANTITY_SPEC_(time, dim_time); -constexpr struct second_ final : named_unit<"s", kind_of