From 819601fcfedd8f129fd57beefe9589355b421d65 Mon Sep 17 00:00:00 2001 From: ivanpanch Date: Sat, 26 Jul 2025 12:02:07 +0200 Subject: [PATCH 01/18] Update units.qbk --- doc/units.qbk | 152 +++++++++++++++++++++++++------------------------- 1 file changed, 76 insertions(+), 76 deletions(-) diff --git a/doc/units.qbk b/doc/units.qbk index 0c7345fc..94bc3507 100644 --- a/doc/units.qbk +++ b/doc/units.qbk @@ -87,22 +87,22 @@ of adding new units and unit conversions are provided in the examples. In order to enable complex compile-time dimensional analysis calculations with no runtime overhead, Boost.Units relies heavily on the [___boost_mpl] (MPL) and on template metaprogramming techniques, and is, as a consequence, fairly demanding of compiler compliance to ISO standards. At present, it has been successfully -compiled and tested on the following compilers/platforms : +compiled and tested on the following compilers/platforms: -# g++ 4.0.1 on Mac OSX 10.4 -# Intel CC 9.1, 10.0, and 10.1 on Mac OSX 10.4 +# g++ 4.0.1 on Mac OS X 10.4 +# Intel CC 9.1, 10.0, and 10.1 on Mac OS X 10.4 # g++ 3.4.4, 4.2.3, and 4.3.0 on Windows XP # Microsoft Visual C++ 7.1, 8.0, and 9.0 on Windows XP # Comeau 4.3.10.1 beta2 on Windows XP -# Metrowerks CodeWarrior 9.2 on Windows XP. +# Metrowerks CodeWarrior 9.2 on Windows XP # Sun CC 5.9 on Solaris and Linux -The following compilers/platforms are known *not* to work : +The following compilers/platforms are known *not* to work: # g++ 3.3.x # Microsoft Visual C++ 6.0 on Windows XP # Microsoft Visual C++ 7.0 on Windows XP -# Metrowerks CodeWarrior 8.0 on Windows XP. +# Metrowerks CodeWarrior 8.0 on Windows XP # All versions of Borland. [endsect] @@ -110,27 +110,27 @@ The following compilers/platforms are known *not* to work : [section:Quick_Start Quick Start] Before discussing the basics of the library, we first define a few terms that will be used frequently -in the following : +in the following: -* *Base dimension* : A base dimension is loosely defined as a measurable entity of interest; in conventional - dimensional analysis, base dimensions include length (\[L\]), mass (\[M\]), time (\[T\]), etc... but there is +* *Base dimension*: A base dimension is loosely defined as a measurable entity of interest; in conventional + dimensional analysis, base dimensions include length (\[L\]), mass (\[M\]), time (\[T\]), etc. but there is no specific restriction on what base dimensions can be used. Base dimensions are essentially a tag type and provide no dimensional analysis functionality themselves. -* *Dimension* : A collection of zero or more base dimensions, each +* *Dimension*: A collection of zero or more base dimensions, each potentially raised to a different rational power. For example, length = \[L\]^1, area = \[L\]^2, velocity = \[L\]^1/\[T\]^1, and energy = \[M\]^1 \[L\]^2/\[T\]^2 are all dimensions. -* *Base unit* : A base unit represents a specific measure of a dimension. For example, while length is an abstract measure of +* *Base unit*: A base unit represents a specific measure of a dimension. For example, while length is an abstract measure of distance, the meter is a concrete base unit of distance. Conversions are defined using base units. Much like base dimensions, base units are a tag type used solely to define units and do not support dimensional analysis algebra. -* *Unit* : A set of base units raised to rational exponents, e.g. m^1, kg^1, m^1/s^2. -* *System* : A unit system is a collection of base units representing all the measurable entities of interest for a - specific problem. For example, the SI unit system defines seven base units : length (\[L\]) in meters, +* *Unit*: A set of base units raised to rational exponents, e.g. m^1, kg^1, m^1/s^2. +* *System*: A unit system is a collection of base units representing all the measurable entities of interest for a + specific problem. For example, the SI unit system defines seven base units: length (\[L\]) in meters, mass (\[M\]) in kilograms, time (\[T\]) in seconds, current (\[I\]) in amperes, temperature (\[theta\]) in kelvin, amount (\[N\]) in moles, and luminous intensity (\[J\]) in candelas. All measurable entities within the SI system can be represented as products of various integer or rational powers of these seven base units. -* *Quantity* : A quantity represents a concrete amount of a unit. Thus, while the meter is the base +* *Quantity*: A quantity represents a concrete amount of a unit. Thus, while the meter is the base unit of length in the SI system, 5.5 meters is a quantity of length in that system. To begin, we present two short tutorials. [@../../libs/units/tutorial/tutorial_1.cpp Tutorial1] demonstrates the use of @@ -142,13 +142,13 @@ and outputs the result to `std::cout`. The [___quantity] class accepts a second this parameter defaults to `double` if not otherwise specified. To demonstrate the ease of using user-defined types in dimensional calculations, we also present code for computing the complex impedance using `std::complex` -as the value type : +as the value type: [import ../example/tutorial.cpp] [tutorial_code] -The intent and function of the above code should be obvious; the output produced is : +The intent and function of the above code should be obvious; the output produced is: [tutorial_output] @@ -183,7 +183,7 @@ collectively referred to as [@http://en.wikipedia.org/wiki/Natural_units natural quantities representing different measurables are combined, dimensional analysis provides the means of assessing the consistency of the resulting calculation. For example, the sum of two lengths is also a length, while the product of two lengths is an area, and the sum of a length and an area is undefined. The fact that the -arguments to many functions (such as exp, log, etc...) must be dimensionless quantities can be easily demonstrated by +arguments to many functions (such as exp, log, etc.) must be dimensionless quantities can be easily demonstrated by examining their series expansions in the context of dimensional analysis. This library facilitates the enforcement of this type of restriction in code involving dimensioned quantities where appropriate. @@ -213,7 +213,7 @@ In order to be able to perform computations on arbitrary sets of dimensions, all composite dimensions must be reducible to an unambiguous final composite dimension, which we will refer to as a *reduced dimension*, for which -# fundamental dimensions are consistently ordered +# fundamental dimensions are consistently ordered, # dimensions with zero exponent are elided. Note that reduced dimensions never have more than [$../../libs/units/images/form_0.png] base dimensions, one for each distinct fundamental dimension, but may have fewer. @@ -269,21 +269,21 @@ reduced dimension in different systems (like feet and meters) cannot be inadvert There are two distinct types of systems that can be envisioned: -* *Homogeneous systems* : Systems which hold a linearly independent set of base units which +* *Homogeneous systems*: Systems which hold a linearly independent set of base units which can be used to represent many different dimensions. For example, the SI system has seven base dimensions and seven base units corresponding to them. It can represent any unit which uses only those seven base dimensions. Thus it is a homogeneous_system. -* *Heterogeneous systems* : Systems which store the exponents of every base unit involved +* *Heterogeneous systems*: Systems which store the exponents of every base unit involved are termed heterogeneous. Some units can only be represented in this way. For example, area in m ft is intrinsically heterogeneous, because the base units of meters and feet have identical dimensions. As a result, simply storing a dimension and a set of base units does not yield a unique solution. A practical example of the need for heterogeneous - units, is an empirical equation used in aviation: H = (r/C)^2 where H is the radar beam + units is an empirical equation used in aviation: H = (r/C)^2 where H is the radar beam height in feet and r is the radar range in nautical miles. In order to enforce dimensional correctness of this equation, the constant, C, must be expressed in nautical miles per foot^(1/2), mixing two distinct base units of length. -Units are implemented by the [___unit] template class defined in [headerref boost/units/unit.hpp] : +Units are implemented by the [___unit] template class defined in [headerref boost/units/unit.hpp]: template class unit; @@ -375,7 +375,7 @@ value type, and the dimensional analysis algebra for the associated unit. In add between units and quantities to simplify the definition of quantities; it is effectively equivalent to algebra with a unit-valued quantity. -Quantities are implemented by the [___quantity] template class defined in [headerref boost/units/quantity.hpp] : +Quantities are implemented by the [___quantity] template class defined in [headerref boost/units/quantity.hpp]: template class quantity; @@ -384,7 +384,7 @@ floating point if not otherwise specified. The value type must have a normal co assignment operator. Operators +, -, *, and / are provided for algebraic operations between scalars and units, scalars and quantities, units and quantities, and between quantities. In addition, integral and rational powers and roots can be computed using the [___pow] and [___root] functions. Finally, -the standard set of boolean comparison operators ( `==, !=, <, <=, >, and >=` ) are provided to allow +the standard set of boolean comparison operators (`==`, `!=`, `<`, `<=`, `>`, and `>=`) are provided to allow comparison of quantities from the same unit system. All operators simply delegate to the corresponding operator of the value type if the units permit. @@ -416,7 +416,7 @@ this would amount to something like the following: [section:Conversions Conversions] Conversion is only meaningful for quantities as it implies the presence of at -least a multiplicative scale factor and, possibly, and affine linear offset. +least a multiplicative scale factor and, possibly, an affine linear offset. Macros for simplifying the definition of conversions between units can be found in [headerref boost/units/conversion.hpp] and [headerref boost/units/absolute.hpp] (for affine conversions with offsets). @@ -451,7 +451,7 @@ with a single specialization: struct my_unit_tag : boost::units::base_unit {}; // define the conversion factor BOOST_UNITS_DEFINE_CONVERSION_FACTOR(my_unit_tag, SI::force, double, 3.14159265358979323846); - // make conversion to SI the default. + // make conversion to SI the default BOOST_UNITS_DEFAULT_CONVERSION(my_unit_tag, SI::force); [endsect] @@ -461,7 +461,7 @@ with a single specialization: This library is designed to emphasize safety above convenience when performing operations with dimensioned quantities. Specifically, construction of quantities is required to fully specify both value and unit. Direct construction from a scalar value is prohibited (though the static member function [___from_value] is provided to enable -this functionality where it is necessary. In addition, a [___quantity_cast] to a reference allows direct access to the +this functionality where it is necessary). In addition, a [___quantity_cast] to a reference allows direct access to the underlying value of a [___quantity] variable. An explicit constructor is provided to enable conversion between dimensionally compatible quantities in different unit systems. Implicit conversions between unit systems are allowed only when the reduced units are identical, allowing, for example, trivial conversions between @@ -473,15 +473,15 @@ to the underlying value type is allowed via class template specialization. Quant convertible only if the value types are themselves implicitly convertible. The [___quantity] class also defines a `value()` member for directly accessing the underlying value. -To summarize, conversions are allowed under the following conditions : +To summarize, conversions are allowed under the following conditions: -* implicit conversion of `quantity` to `quantity` is allowed if `Y` and `Z` are implicitly convertible. -* assignment between `quantity` and `quantity` is allowed if `Y` and `Z` are implicitly convertible. -* explicit conversion between `quantity` and `quantity` is allowed if `Unit1` and `Unit2` have the same dimensions +* Implicit conversion of `quantity` to `quantity` is allowed if `Y` and `Z` are implicitly convertible. +* Assignment between `quantity` and `quantity` is allowed if `Y` and `Z` are implicitly convertible. +* Explicit conversion between `quantity` and `quantity` is allowed if `Unit1` and `Unit2` have the same dimensions and if `Y` and `Z` are implicitly convertible. -* implicit conversion between `quantity` and `quantity` is allowed if `Unit1` +* Implicit conversion between `quantity` and `quantity` is allowed if `Unit1` reduces to exactly the same combination of base units as `Unit2` and if `Y` and `Z` are convertible. -* assignment between `quantity` and `quantity` is allowed under the same +* Assignment between `quantity` and `quantity` is allowed under the same conditions as implicit conversion. * `quantity` can be directly constructed from a value of type `Y` using the static member function [___from_value]. Doing so, naturally, bypasses any type-checking of the newly assigned value, so this method should be used only when absolutely necessary. @@ -505,7 +505,7 @@ the underlying value type or types that are convertible to/from that value type. By using MPL metafunctions and the template specializations for operations on composite dimensions (defined in [headerref boost/units/dimension.hpp]) it is possible to perform compile time arithmetic according to the dimensional analysis rules described [link boost_units.Dimensional_Analysis above] -to produce new composite dimensions : +to produce new composite dimensions: [import ../example/dimension.cpp] @@ -523,7 +523,7 @@ outputting (with symbol demangling, implemented in ([@../../libs/units/example/unit.cpp unit.cpp]) This example demonstrates the use of the simple but functional unit system implemented in -[@boost:/libs/units/example/test_system.hpp test_system.hpp] +[@boost:/libs/units/example/test_system.hpp test_system.hpp]: [import ../example/unit.cpp] @@ -539,24 +539,24 @@ We can perform various algebraic operations on these units, resulting in the fol ([@../../libs/units/example/quantity.cpp quantity.cpp]) -This example demonstrates how to use quantities of our toy unit system : +This example demonstrates how to use quantities of our toy unit system: [import ../example/quantity.cpp] [quantity_snippet_1] -giving us the basic quantity functionality : +giving us the basic quantity functionality: [quantity_output_double] As a further demonstration of the flexibility of the system, we replace the `double` value type with a `std::complex` value type (ignoring the question of the meaningfulness of -complex lengths and energies) : +complex lengths and energies): [quantity_snippet_2] and find that the code functions exactly as expected with no additional work, delegating operations -to `std::complex` and performing the appropriate dimensional analysis : +to `std::complex` and performing the appropriate dimensional analysis: [quantity_output_complex] @@ -579,27 +579,27 @@ the various algebraic operations between scalars, units, and quantities give [kitchen_sink_output_1] -Scalar/unit operations : +Scalar/unit operations: [kitchen_sink_output_2] -Unit/unit operations and integral/rational powers of units : +Unit/unit operations and integral/rational powers of units: [kitchen_sink_output_3] -Scalar/quantity operations : +Scalar/quantity operations: [kitchen_sink_output_4] -Unit/quantity operations : +Unit/quantity operations: [kitchen_sink_output_5] -Quantity/quantity operations and integral/rational powers of quantities : +Quantity/quantity operations and integral/rational powers of quantities: [kitchen_sink_output_6] -Logical comparison operators are also defined between quantities : +Logical comparison operators are also defined between quantities: [kitchen_sink_snippet_2] @@ -607,7 +607,7 @@ giving [kitchen_sink_output_7] -Implicit conversion is allowed between dimensionless quantities and their corresponding value types : +Implicit conversion is allowed between dimensionless quantities and their corresponding value types: [kitchen_sink_snippet_3] @@ -618,25 +618,25 @@ in an arbitrary unit system and returns energy in the same system: [kitchen_sink_snippet_4] -which functions as expected for SI quantities : +which functions as expected for SI quantities: [kitchen_sink_output_9] -The ideal gas law can also be implemented in SI units : +The ideal gas law can also be implemented in SI units: [kitchen_sink_function_snippet_4] [kitchen_sink_snippet_5] -with the resulting output : +with the resulting output: [kitchen_sink_output_10] Trigonometric and inverse trigonometric functions can be implemented for any unit system that provides an angular base dimension. For radians, these functions are found in -[headerref boost/units/cmath.hpp] These behave as one expects, with trigonometric functions +[headerref boost/units/cmath.hpp]. These behave as one expects, with trigonometric functions taking an angular quantity and returning a dimensionless quantity, while the inverse trigonometric functions -take a dimensionless quantity and return an angular quantity : +take a dimensionless quantity and return an angular quantity: Defining a few angular quantities, @@ -646,7 +646,7 @@ yields [kitchen_sink_output_11] -Dealing with complex quantities is trivial. Here is the calculation of complex impedance : +Dealing with complex quantities is trivial. Here is the calculation of complex impedance: [kitchen_sink_snippet_7] @@ -673,7 +673,7 @@ gives [kitchen_sink_output_13] If we implement the overloaded helper classes for rational powers and roots -then we can also compute rational powers of measurement quantities : +then we can also compute rational powers of measurement quantities: [kitchen_sink_output_14] @@ -697,19 +697,19 @@ of the value types themselves is allowed. N.B. The conversion from double to in as an explicit conversion because there is no way to emulate the exact behavior of the built-in conversion. Explicit constructors allow conversions for two cases: -* explicit casting of a [___quantity] to a different `value_type` : +* explicit casting of a [___quantity] to a different `value_type`: [conversion_snippet_3] -* and explicit casting of a [___quantity] to a different unit : +* and explicit casting of a [___quantity] to a different unit: [conversion_snippet_4] -giving the following output : +giving the following output: [conversion_output_1] -A few more explicit unit system conversions : +A few more explicit unit system conversions: [conversion_snippet_5] @@ -733,7 +733,7 @@ powers and roots, respectively: [quaternion_class_snippet_1b] -We can now declare a [___quantity] of a `quaternion` : +We can now declare a [___quantity] of a `quaternion`: [quaternion_snippet_1] @@ -743,7 +743,7 @@ no additional changes. [quaternion_output_1] -Now, if for some reason we preferred the [___quantity] to be the value type of the `quaternion` class we would have : +Now, if for some reason we preferred the [___quantity] to be the value type of the `quaternion` class we would have: [quaternion_snippet_2] @@ -774,17 +774,17 @@ operations and rational powers and roots. Naturally, heterogeneous operations ar compilers that implement `typeof`. The primary differences are that binary operations are not implemented using the `op=` operators and use the utility classes [___add_typeof_helper], [___subtract_typeof_helper], [___multiply_typeof_helper], and [___divide_typeof_helper]. In addition, [___power_typeof_helper] and -[___root_typeof_helper] are defined for both cases : +[___root_typeof_helper] are defined for both cases: [import ../example/complex.cpp] [complex_class_snippet_1] -With this replacement `complex` class, we can declare a complex variable : +With this replacement `complex` class, we can declare a complex variable: [complex_snippet_1] -to get the correct behavior for all cases supported by [___quantity] with a `complex` value type : +to get the correct behavior for all cases supported by [___quantity] with a `complex` value type: [complex_output_1] @@ -819,34 +819,34 @@ using msvc 8.0 on Windows XP. [import ../example/radar_beam_height.cpp] This example demonstrates the implementation of two non-SI units of length, the -nautical mile : +nautical mile: [radar_beam_height_class_snippet_1] -and the imperial foot : +and the imperial foot: [radar_beam_height_class_snippet_2] These units include conversions between themselves and the meter. Three functions for computing radar beam height from radar range and the local earth radius are defined. The first takes arguments in one system and returns a value in the same -system : +system: [radar_beam_height_function_snippet_1] The second is similar, but is templated on return type, so that the arguments are -converted to the return unit system internally : +converted to the return unit system internally: [radar_beam_height_function_snippet_2] Finally, the third function is an empirical approximation that is only valid for radar ranges specified in nautical miles, returning beam height in feet. This function uses the heterogeneous unit of nautical miles per square root of feet to -ensure dimensional correctness : +ensure dimensional correctness: [radar_beam_height_function_snippet_3] -With these, we can compute radar beam height in various unit systems : +With these, we can compute radar beam height in various unit systems: [radar_beam_height_snippet_1] @@ -980,18 +980,18 @@ The iostream manipulators `engineering_prefixes` or `binary_prefixes` make this [autoprefixes_snippet_1] (The complete set of [@http://physics.nist.gov/cuu/Units/prefixes.html engineering and scientific multiples] -is not used (not centi or deci for example), but only powers of ten that are multiples of three, 10^3). +is not used (not centi or deci for example), but only powers of one thousand.) Similarly, the equivalent [@http://en.wikipedia.org/wiki/Binary_prefixes binary prefixes] used for displaying computing kilobytes, megabytes, gigabytes... These are the 2^10 = 1024, 2^20 = 1 048 576, 2^30 ... multiples. -(See also [@http://physics.nist.gov/cuu/Units/binary.html Prefixes for binary multiples] +(See also [@http://physics.nist.gov/cuu/Units/binary.html Prefixes for binary multiples]. This scale is specified in IEC 60027-2, Second edition, 2000-11, Letter symbols to be used in electrical technology - -Part 2: Telecommunications and electronics). +Part 2: Telecommunications and electronics.) [autoprefixes_snippet_2] @@ -1041,7 +1041,7 @@ Produces [import ../example/runtime_unit.cpp] This example shows how to implement an interface that -allow different units at runtime while still maintaining +allows different units at runtime while still maintaining type safety for internal calculations. [runtime_unit_snippet_1] @@ -1207,10 +1207,10 @@ Consider the following code: cout << asin(sin(90.0 * degrees)); What should this print? If only heterogeneous -systems are available it would print 1.5708 rad +systems are available it would print 1.5708 rad. Why? Well, `sin` would return a `quantity` effectively losing the information that degrees -are being used. In order to propogate this extra information +are being used. In order to propagate this extra information we need homogeneous systems. [endsect] @@ -1226,7 +1226,7 @@ consider the search and replace problem allowing this poses: Here, the intent is clear - we want a length of one in the SI system, which is one meter. However, imagine some well-intentioned coder attempting to reuse this code, but to have it perform the -calculations in the CGS unit system instead. After searching for `si::` and replacing it with `cgs::` , +calculations in the CGS unit system instead. After searching for `si::` and replacing it with `cgs::`, we have: quantity q(1.0); From 33e9e375aaf12925e055cc5fd5a5fce3906d3e2d Mon Sep 17 00:00:00 2001 From: ivanpanch Date: Sat, 26 Jul 2025 12:08:46 +0200 Subject: [PATCH 02/18] Update autoprefixes.cpp --- example/autoprefixes.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/example/autoprefixes.cpp b/example/autoprefixes.cpp index 090be090..f68dd880 100644 --- a/example/autoprefixes.cpp +++ b/example/autoprefixes.cpp @@ -95,7 +95,7 @@ int main() //] [/autoprefixes_snippet_1] //[autoprefixes_snippet_2 - // Don't forget that the units name or symbol format specification is persistent. + // Don't forget that the unit name or symbol format specification is persistent. cout << symbol_format << endl; // Resets the format to the default symbol format. quantity b = 2048. * byte_base_unit::unit_type(); @@ -118,7 +118,7 @@ int main() const length L; // A unit of length (but not a quantity of length). cout << L << endl; // Default length unit is meter, // but default is symbol format so output is just "m". - cout << name_format << L << endl; // default length name is "meter". + cout << name_format << L << endl; // Default length name is "meter". //] [/autoprefixes_snippet_4] //[autoprefixes_snippet_5 From 3c30cf0e4920f676a7496e22a18e86c66e203032 Mon Sep 17 00:00:00 2001 From: ivanpanch Date: Sat, 26 Jul 2025 12:19:13 +0200 Subject: [PATCH 03/18] Update kitchen_sink.cpp --- example/kitchen_sink.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example/kitchen_sink.cpp b/example/kitchen_sink.cpp index ece126bc..8a01dd93 100644 --- a/example/kitchen_sink.cpp +++ b/example/kitchen_sink.cpp @@ -355,7 +355,7 @@ int main() << std::endl; //[kitchen_sink_snippet_4 - /// test calcuation of work + /// test calculation of work quantity F(1.0*newton); quantity dx(1.0*meter); quantity E(work(F,dx)); From c1d9fbc5152056eca800cc432ef00ddba1df68f8 Mon Sep 17 00:00:00 2001 From: ivanpanch Date: Sat, 26 Jul 2025 12:24:20 +0200 Subject: [PATCH 04/18] Update lambda.cpp --- example/lambda.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/example/lambda.cpp b/example/lambda.cpp index 0fbac916..ad36d855 100644 --- a/example/lambda.cpp +++ b/example/lambda.cpp @@ -42,9 +42,9 @@ // Include boost/units/lambda.hpp instead of boost/lambda/lambda.hpp // for a convenient usage of Boost.Units' quantity, unit, and absolute // types in lambda expressions. The header augments Boost.Lambda's -// return type detuction system to recognize the new types so that not +// return type deduction system to recognize the new types so that not // for each arithmetic operation the return type needs to be -// explicitely specified. +// explicitly specified. #include #include From ab77c4ab2a53c699d4de6ee72188d3d195bbc8eb Mon Sep 17 00:00:00 2001 From: ivanpanch Date: Sat, 26 Jul 2025 12:39:37 +0200 Subject: [PATCH 05/18] Update tutorial.cpp --- example/tutorial.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/example/tutorial.cpp b/example/tutorial.cpp index acda5ee9..8cc7ecb9 100644 --- a/example/tutorial.cpp +++ b/example/tutorial.cpp @@ -65,7 +65,7 @@ work(const quantity& F, const quantity& dx) int main() { /// Test calculation of work. - quantity F(2.0 * newton); // Define a quantity of force. + quantity F(2.0 * newton); // Define a quantity of force, quantity dx(2.0 * meter); // and a distance, quantity E(work(F,dx)); // and calculate the work done. @@ -75,7 +75,7 @@ int main() << std::endl; /// Test and check complex quantities. - typedef std::complex complex_type; // double real and imaginary parts. + typedef std::complex complex_type; // double real and imaginary parts // Define some complex electrical quantities. quantity v = complex_type(12.5, 0.0) * volts; From eff055d019cd8bf3dfba333ea20aade01db0ea05 Mon Sep 17 00:00:00 2001 From: ivanpanch Date: Sat, 26 Jul 2025 12:58:27 +0200 Subject: [PATCH 06/18] Update linear_algebra.hpp --- include/boost/units/detail/linear_algebra.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/boost/units/detail/linear_algebra.hpp b/include/boost/units/detail/linear_algebra.hpp index 17ed34bd..177c269d 100644 --- a/include/boost/units/detail/linear_algebra.hpp +++ b/include/boost/units/detail/linear_algebra.hpp @@ -63,7 +63,7 @@ struct normalize_units_impl; struct inconsistent {}; -// generally useful utilies. +// generally useful utilities. template struct divide_equation { @@ -371,7 +371,7 @@ struct invert_strip_leading_zeroes { // results // Note that we don't add the pivot row to the - // results here, because it needs to propagated up + // results here, because it needs to propagate up // to the diagonal. typedef typename next::new_matrix new_matrix; typedef typename next::identity_result identity_result; @@ -392,7 +392,7 @@ struct invert_strip_leading_zeroes { // results // Note that we don't add the pivot row to the - // results here, because it needs to propagated up + // results here, because it needs to propagate up // to the diagonal. typedef dimensionless_type identity_result; typedef dimensionless_type new_matrix; @@ -738,7 +738,7 @@ struct calculate_base_dimension_coefficients_impl<0> { }; }; -// add_zeroes pushs N zeroes onto the +// add_zeroes pushes N zeroes onto the // front of a list. // // list add_zeroes(list l, int N) { From 895cba6670c0c20cf4bcd15dfe648ca62df187e0 Mon Sep 17 00:00:00 2001 From: ivanpanch Date: Sat, 26 Jul 2025 13:10:34 +0200 Subject: [PATCH 07/18] Update absolute.hpp --- include/boost/units/absolute.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/units/absolute.hpp b/include/boost/units/absolute.hpp index 25415945..d110938b 100644 --- a/include/boost/units/absolute.hpp +++ b/include/boost/units/absolute.hpp @@ -121,7 +121,7 @@ namespace boost { namespace units { /// Macro to define the offset between two absolute units. -/// Requires the value to be in the destination units e.g +/// Requires the value to be in the destination units, e.g., /// @code /// BOOST_UNITS_DEFINE_CONVERSION_OFFSET(celsius_base_unit, fahrenheit_base_unit, double, 32.0); /// @endcode From bd4babfd8801c9798e3569dde815b43ecc3e0129 Mon Sep 17 00:00:00 2001 From: ivanpanch Date: Sat, 26 Jul 2025 13:13:25 +0200 Subject: [PATCH 08/18] Update base_dimension.hpp --- include/boost/units/base_dimension.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/units/base_dimension.hpp b/include/boost/units/base_dimension.hpp index b8d348e4..23a127d5 100644 --- a/include/boost/units/base_dimension.hpp +++ b/include/boost/units/base_dimension.hpp @@ -73,7 +73,7 @@ class base_dimension : #else typedef detail::unspecified dimension_type; #endif - /// Provided for mpl compatability. + /// Provided for mpl compatibility. typedef Derived type; private: From fcc5bb7624d349eab790c5a80a63ffc3e0687d05 Mon Sep 17 00:00:00 2001 From: ivanpanch Date: Sat, 26 Jul 2025 13:16:28 +0200 Subject: [PATCH 09/18] Update base_unit.hpp --- include/boost/units/base_unit.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/units/base_unit.hpp b/include/boost/units/base_unit.hpp index 511bbb72..bdc8accc 100644 --- a/include/boost/units/base_unit.hpp +++ b/include/boost/units/base_unit.hpp @@ -75,7 +75,7 @@ class base_unit : /// The dimensions of this base unit. typedef Dim dimension_type; - /// Provided for mpl compatability. + /// Provided for mpl compatibility. typedef Derived type; /// The unit corresponding to this base unit. From eff81546158846a63af67f004e10c7dccd94fae3 Mon Sep 17 00:00:00 2001 From: ivanpanch Date: Sat, 26 Jul 2025 15:49:25 +0200 Subject: [PATCH 10/18] Update conversion.hpp --- include/boost/units/conversion.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/boost/units/conversion.hpp b/include/boost/units/conversion.hpp index f5d4a1ef..e4c349bd 100644 --- a/include/boost/units/conversion.hpp +++ b/include/boost/units/conversion.hpp @@ -28,7 +28,7 @@ struct conversion_helper; /// Template for defining conversions between /// quantities. This template should be specialized /// for every quantity that allows conversions. -/// For example, if you have a two units +/// For example, if you have two units /// called pair and dozen you would write /// @code /// namespace boost { @@ -87,7 +87,7 @@ struct conversion_helper /// Defines the conversion factor from a base unit to any other base /// unit with the same dimensions. Params should be a Boost.Preprocessor -/// Seq of template parameters, such as (class T1)(class T2) +/// Seq of template parameters, such as (class T1)(class T2). /// All uses of must appear at global scope. The reverse conversion will /// be defined automatically. This macro is a little dangerous, because, /// unlike the non-template form, it will silently fail if either base From d13d88b31eca3e1d7f7cc68c7ce93f4ff01e1ce9 Mon Sep 17 00:00:00 2001 From: ivanpanch Date: Sat, 26 Jul 2025 15:57:10 +0200 Subject: [PATCH 11/18] Update dimension.hpp --- include/boost/units/dimension.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/units/dimension.hpp b/include/boost/units/dimension.hpp index 90334a17..d8cb5e7e 100644 --- a/include/boost/units/dimension.hpp +++ b/include/boost/units/dimension.hpp @@ -44,7 +44,7 @@ namespace units { /// - @c mpl::negate will return its argument unchanged. /// - @c mpl::times is defined for any dimensions and adds corresponding exponents. /// - @c mpl::divides is defined for any dimensions and subtracts the exponents of the -/// right had argument from the corresponding exponents of the left had argument. +/// right hand argument from the corresponding exponents of the left hand argument. /// Missing base dimension tags are assumed to have an exponent of zero. /// - @c static_power takes a dimension and a static_rational and multiplies all /// the exponents of the dimension by the static_rational. From 48aedd7d7e62aa1b382ff092078a50b20381c0c9 Mon Sep 17 00:00:00 2001 From: ivanpanch Date: Sat, 26 Jul 2025 16:18:09 +0200 Subject: [PATCH 12/18] Update io.hpp --- include/boost/units/io.hpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/include/boost/units/io.hpp b/include/boost/units/io.hpp index 31f4d643..c64c40cf 100644 --- a/include/boost/units/io.hpp +++ b/include/boost/units/io.hpp @@ -97,7 +97,7 @@ struct base_unit_info { return(BaseUnit::name()); } - /// The symbol for the base unit (Returns BaseUnit::symbol() by default) + /// The symbol for the base unit (returns BaseUnit::symbol() by default) static std::string symbol() { return(BaseUnit::symbol()); /// \returns BaseUnit::symbol(), for example "m" @@ -238,7 +238,7 @@ inline std::ios_base& engineering_prefix(std::ios_base& ios) return ios; } -/// Set flag for binary prefix, so 1024 byte displays as "1 Kib". +/// Set flag for binary prefix, so 1024 byte displays as "1 KiB". inline std::ios_base& binary_prefix(std::ios_base& ios) { (set_autoprefix)(ios, autoprefix_binary); @@ -411,7 +411,7 @@ struct scale_name_string_impl<0> namespace detail { // These two overloads of symbol_string and name_string will -// will pick up homogeneous_systems. They simply call the +// pick up homogeneous_systems. They simply call the // appropriate function with a heterogeneous_system. template inline std::string @@ -481,7 +481,7 @@ to_string_impl(const unit inline std::string @@ -496,7 +496,7 @@ to_string_impl(const unit())); } -// this overload disambuguates between the overload for an unscaled unit +// this overload disambiguates between the overload for an unscaled unit // and the overload for a scaled base unit raised to the first power. /// INTERNAL ONLY template @@ -848,7 +848,7 @@ maybe_parenthesize(const unit inline std::string From 0cc32404a98314c502b02b0f61d014e08b6f955b Mon Sep 17 00:00:00 2001 From: ivanpanch Date: Sat, 26 Jul 2025 16:38:07 +0200 Subject: [PATCH 13/18] Update operators.hpp --- include/boost/units/operators.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/boost/units/operators.hpp b/include/boost/units/operators.hpp index 6941aaff..bda76186 100644 --- a/include/boost/units/operators.hpp +++ b/include/boost/units/operators.hpp @@ -128,7 +128,7 @@ template struct root_typeof_helper; /// conform to the interface shown here. /// @c Exponent will be either the exponent /// passed to @c pow or @c static_rational -/// for and integer argument, N. +/// for an integer argument, N. template struct power_typeof_helper { @@ -145,7 +145,7 @@ struct power_typeof_helper /// conform to the interface shown here. /// @c Index will be either the type /// passed to @c pow or @c static_rational -/// for and integer argument, N. +/// for an integer argument, N. template struct root_typeof_helper { From bf132b02f4a0dd746df01e51774f6b784464d579 Mon Sep 17 00:00:00 2001 From: ivanpanch Date: Sat, 26 Jul 2025 17:13:10 +0200 Subject: [PATCH 14/18] Update unit.hpp --- include/boost/units/unit.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/units/unit.hpp b/include/boost/units/unit.hpp index aa4611cf..4ec5ade8 100644 --- a/include/boost/units/unit.hpp +++ b/include/boost/units/unit.hpp @@ -50,7 +50,7 @@ class unit // sun will ignore errors resulting from templates // instantiated in the return type of a function. - // Make sure that we get an error anyway by putting. + // Make sure that we get an error anyway by putting // the check in the destructor. #ifdef __SUNPRO_CC ~unit() { From de505a1f4dfcfcc1aba3c6b9cb26b698c24df86f Mon Sep 17 00:00:00 2001 From: ivanpanch Date: Sat, 26 Jul 2025 17:15:16 +0200 Subject: [PATCH 15/18] Update fail_add_temperature.cpp --- test/fail_add_temperature.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/fail_add_temperature.cpp b/test/fail_add_temperature.cpp index 979b2363..c59d3574 100644 --- a/test/fail_add_temperature.cpp +++ b/test/fail_add_temperature.cpp @@ -14,7 +14,7 @@ \brief fail_add_temperature.cpp \details -Verify that adding two absolute temeratures fails miserably. +Verify that adding two absolute temperatures fails miserably. Output: @verbatim From a47d15606225e21bfaa7adc6a9a1f986cca98f29 Mon Sep 17 00:00:00 2001 From: ivanpanch Date: Sat, 26 Jul 2025 17:26:07 +0200 Subject: [PATCH 16/18] Update test_output.cpp --- test/test_output.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_output.cpp b/test/test_output.cpp index a59a73bd..24b253c3 100644 --- a/test/test_output.cpp +++ b/test/test_output.cpp @@ -443,7 +443,7 @@ void test_output_auto_binary_prefixed_quantity_name() } // Tests on using more than one format or prefix - only the last specified should be used. -// (This may indicate a programming mistake, but it is ignored). +// (This may indicate a programming mistake, but it is ignored.) void test_output_quantity_name_duplicate() { // Ensure that if more than one format specified, only the last is used. #define FORMATTERS << boost::units::symbol_format << boost::units::name_format From 8a7237562b556bc3c69ee47cc0d679dce7886438 Mon Sep 17 00:00:00 2001 From: ivanpanch Date: Sun, 27 Jul 2025 01:55:37 +0200 Subject: [PATCH 17/18] Update autoprefixes.cpp --- example/autoprefixes.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example/autoprefixes.cpp b/example/autoprefixes.cpp index f68dd880..f9028b08 100644 --- a/example/autoprefixes.cpp +++ b/example/autoprefixes.cpp @@ -95,7 +95,7 @@ int main() //] [/autoprefixes_snippet_1] //[autoprefixes_snippet_2 - // Don't forget that the unit name or symbol format specification is persistent. + // Don't forget that the units name or symbol format specification is persistent. cout << symbol_format << endl; // Resets the format to the default symbol format. quantity b = 2048. * byte_base_unit::unit_type(); From 9590c09636809c0b0c8732a9d9ef8fd2b4f28858 Mon Sep 17 00:00:00 2001 From: ivanpanch Date: Sun, 27 Jul 2025 09:38:13 +0200 Subject: [PATCH 18/18] Update autoprefixes.cpp --- example/autoprefixes.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example/autoprefixes.cpp b/example/autoprefixes.cpp index f9028b08..d11f9e0c 100644 --- a/example/autoprefixes.cpp +++ b/example/autoprefixes.cpp @@ -91,7 +91,7 @@ int main() quantity e = kilograms * pow<2>(l / seconds); // A quantity of energy. cout << engineering_prefix << e << endl; // 5.49902 MJ - cout << name_format << engineering_prefix << e << endl; // 5.49902 megaJoule + cout << name_format << engineering_prefix << e << endl; // 5.49902 megajoule //] [/autoprefixes_snippet_1] //[autoprefixes_snippet_2