mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-01 19:34:29 +02:00
docs: "you" replaced to "we" in many places
This commit is contained in:
@@ -80,4 +80,4 @@ int main()
|
|||||||
|
|
||||||
!!! note
|
!!! note
|
||||||
|
|
||||||
You can find more code examples in the [Examples](../users_guide/examples/tags_index.md) chapter.
|
More code examples can be found in the [Examples](../users_guide/examples/tags_index.md) chapter.
|
||||||
|
@@ -37,8 +37,8 @@ Many reasons make UDLs a poor choice for a physical units library:
|
|||||||
to specify which one to use in case both namespaces are "imported" with using directives.
|
to specify which one to use in case both namespaces are "imported" with using directives.
|
||||||
|
|
||||||
5. Another bad property of UDLs is that they do not compose. A coherent unit of angular momentum would
|
5. Another bad property of UDLs is that they do not compose. A coherent unit of angular momentum would
|
||||||
have a UDL specified as `_q_kg_m2_per_s`. Now imagine that you want to make every possible user happy.
|
have a UDL specified as `_q_kg_m2_per_s`. Now imagine that we want to make every possible user happy.
|
||||||
How many variations of that unit would you predefine for differently scaled versions of all unit
|
How many variations of that unit would we predefine for differently scaled versions of all unit
|
||||||
ingredients?
|
ingredients?
|
||||||
|
|
||||||
6. UDLs are also really expensive to define and specify. Typically, for each unit, we need two
|
6. UDLs are also really expensive to define and specify. Typically, for each unit, we need two
|
||||||
@@ -124,8 +124,8 @@ it might be either a quantity or a fundamental type. If we want to raise such a
|
|||||||
must use `units::pow` or `std::pow` depending on the resulting type. Those are only a few issues related
|
must use `units::pow` or `std::pow` depending on the resulting type. Those are only a few issues related
|
||||||
to such an approach.
|
to such an approach.
|
||||||
|
|
||||||
Moreover, suppose you divide quantities of the same dimension but with units of significantly different
|
Moreover, suppose we divide quantities of the same dimension but with units of significantly different
|
||||||
magnitudes. In that case, you may end up with a really small or a huge floating-point value, which may result
|
magnitudes. In that case, we may end up with a really small or a huge floating-point value, which may result
|
||||||
in losing lots of precision. Returning a dimensionless quantity from such cases allows us to benefit from
|
in losing lots of precision. Returning a dimensionless quantity from such cases allows us to benefit from
|
||||||
all the properties of scaled units and is consistent with the rest of the library.
|
all the properties of scaled units and is consistent with the rest of the library.
|
||||||
|
|
||||||
@@ -175,7 +175,7 @@ we have to obey the rules and be consistent with ISO specifications.
|
|||||||
has the option of [ASCII-only Quantity Symbols](../users_guide/framework_basics/text_output.md#unit-symbol-formatting).
|
has the option of [ASCII-only Quantity Symbols](../users_guide/framework_basics/text_output.md#unit-symbol-formatting).
|
||||||
|
|
||||||
|
|
||||||
## Why don't you have CMake options to disable the building of tests and examples?
|
## Why don't we have CMake options to disable the building of tests and examples?
|
||||||
|
|
||||||
Over time, many people provided PRs proposing adding options to build tests and examples conditionally.
|
Over time, many people provided PRs proposing adding options to build tests and examples conditionally.
|
||||||
Here are a few examples:
|
Here are a few examples:
|
||||||
|
@@ -67,7 +67,7 @@ This repository contains three independent CMake-based projects:
|
|||||||
that prefer to use CMake's `add_subdirectory()` to handle the dependencies.
|
that prefer to use CMake's `add_subdirectory()` to handle the dependencies.
|
||||||
|
|
||||||
To learn more about the rationale, please check our
|
To learn more about the rationale, please check our
|
||||||
[FAQ](faq.md#why-dont-you-have-cmake-options-to-disable-building-of-tests-and-examples).
|
[FAQ](faq.md#why-dont-we-have-cmake-options-to-disable-building-of-tests-and-examples).
|
||||||
|
|
||||||
|
|
||||||
## Obtaining Dependencies
|
## Obtaining Dependencies
|
||||||
@@ -107,13 +107,13 @@ tools.build:compiler_executables={"c": "gcc-12", "cpp": "g++-12"}
|
|||||||
!!! tip "Setting the language version"
|
!!! tip "Setting the language version"
|
||||||
|
|
||||||
Please note that the **mp-units** library requires at least C++20 to be set in a Conan profile
|
Please note that the **mp-units** library requires at least C++20 to be set in a Conan profile
|
||||||
or forced via the Conan command line. If you do the former, you will not need to provide
|
or forced via the Conan command line. If we do the former, we will not need to provide
|
||||||
`-s compiler.cppstd=20` every time you run a Conan command line (as provided in the command
|
`-s compiler.cppstd=20` every time we run a Conan command line (as provided in the command
|
||||||
line instructions below).
|
line instructions below).
|
||||||
|
|
||||||
!!! tip "Using Ninja as a CMake generator for Conan"
|
!!! tip "Using Ninja as a CMake generator for Conan"
|
||||||
|
|
||||||
It is highly recommended to set Ninja as a CMake generator for Conan. To do so, you should
|
It is highly recommended to set Ninja as a CMake generator for Conan. To do so, we should
|
||||||
create a _~/.conan2/global.conf_ file that will set `tools.cmake.cmaketoolchain:generator`
|
create a _~/.conan2/global.conf_ file that will set `tools.cmake.cmaketoolchain:generator`
|
||||||
to one of the Ninja generators. For example:
|
to one of the Ninja generators. For example:
|
||||||
|
|
||||||
@@ -132,7 +132,7 @@ tools.build:compiler_executables={"c": "gcc-12", "cpp": "g++-12"}
|
|||||||
tools.cmake.cmake_layout:build_folder_vars=["settings.compiler", "settings.compiler.version", "settings.compiler.cppstd"]
|
tools.cmake.cmake_layout:build_folder_vars=["settings.compiler", "settings.compiler.version", "settings.compiler.cppstd"]
|
||||||
```
|
```
|
||||||
|
|
||||||
In such a case, you will need to use a configuration-specific preset name in the Conan instructions
|
In such a case, we will need to use a configuration-specific preset name in the Conan instructions
|
||||||
provided below rather than just `conan-default` and `conan-release`
|
provided below rather than just `conan-default` and `conan-release`
|
||||||
(e.g. `conan-gcc-13-23` and `conan-gcc-13-23-release`)
|
(e.g. `conan-gcc-13-23` and `conan-gcc-13-23-release`)
|
||||||
|
|
||||||
@@ -366,7 +366,8 @@ with the following differences:
|
|||||||
### Install
|
### Install
|
||||||
|
|
||||||
In case you don't want to use Conan in your project and just want to install the **mp-units**
|
In case you don't want to use Conan in your project and just want to install the **mp-units**
|
||||||
library on your file system and use `find_package(mp-units)` from another repository to find it; it is enough to perform the following steps:
|
library on your file system and use `find_package(mp-units)` from another repository to find it;
|
||||||
|
it is enough to perform the following steps:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
conan install . -pr <your_conan_profile> -s compiler.cppstd=20 -b=missing
|
conan install . -pr <your_conan_profile> -s compiler.cppstd=20 -b=missing
|
||||||
|
@@ -169,7 +169,7 @@ associated with this quantity type.
|
|||||||
as a vector or tensor quantity representation type.
|
as a vector or tensor quantity representation type.
|
||||||
|
|
||||||
To enable the usage of a user-defined type as a representation type for vector or tensor quantities,
|
To enable the usage of a user-defined type as a representation type for vector or tensor quantities,
|
||||||
you need to provide a partial specialization of `is_vector` or `is_tensor` customization points.
|
we need to provide a partial specialization of `is_vector` or `is_tensor` customization points.
|
||||||
|
|
||||||
For example, here is how it can be done for the [P1385](https://wg21.link/p1385) types:
|
For example, here is how it can be done for the [P1385](https://wg21.link/p1385) types:
|
||||||
|
|
||||||
@@ -223,12 +223,12 @@ either:
|
|||||||
|
|
||||||
## Hacking the character
|
## Hacking the character
|
||||||
|
|
||||||
Sometimes you want to use a vector quantity, but you don't care about its direction. For example,
|
Sometimes we want to use a vector quantity, but we don't care about its direction. For example,
|
||||||
the standard gravity acceleration constant always points down, so you might not care about this
|
the standard gravity acceleration constant always points down, so we might not care about this
|
||||||
in a particular scenario. In such a case, you may want to "hack" the library to allow scalar types
|
in a particular scenario. In such a case, we may want to "hack" the library to allow scalar types
|
||||||
to be used as a representation type for scalar quantities.
|
to be used as a representation type for scalar quantities.
|
||||||
|
|
||||||
For example, you can do the following:
|
For example, we can do the following:
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
template<class T>
|
template<class T>
|
||||||
|
@@ -55,7 +55,7 @@ possible. For example, to create a quantity with a unit of speed, one may write:
|
|||||||
quantity<si::metre / si::second> q;
|
quantity<si::metre / si::second> q;
|
||||||
```
|
```
|
||||||
|
|
||||||
In case you use such an unit often and would prefer to have a handy helper for it, you can
|
In case we use such an unit often and would prefer to have a handy helper for it, we can
|
||||||
always do something like this:
|
always do something like this:
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
|
@@ -116,9 +116,9 @@ error: could not convert 'mp_units::operator*<si::metre(), double, si::second(),
|
|||||||
|
|
||||||
## Typed quantities
|
## Typed quantities
|
||||||
|
|
||||||
Simple mode is all about and just about units. In case you care about a specific quantity type,
|
Simple mode is all about and just about units. In case we care about a specific quantity type,
|
||||||
**typed quantities** should be preferred. With this mode, for example, you can specify if you
|
**typed quantities** should be preferred. With this mode, for example, we can specify if we
|
||||||
deal with `width`, `height`, or `radius` and ensure you will not assign one to another by
|
deal with `width`, `height`, or `radius` and ensure we will not assign one to another by
|
||||||
accident.
|
accident.
|
||||||
|
|
||||||
The previous example can be re-typed using typed quantities in the following way:
|
The previous example can be re-typed using typed quantities in the following way:
|
||||||
|
@@ -174,8 +174,8 @@ std::println("|{:*^10}|", 123 * m); // |**123 m***|
|
|||||||
|
|
||||||
!!! note
|
!!! note
|
||||||
|
|
||||||
[`std::println` is a C++23 facility](https://en.cppreference.com/w/cpp/io/print). In case you
|
[`std::println` is a C++23 facility](https://en.cppreference.com/w/cpp/io/print). In case we
|
||||||
do not have access to C++23, you can obtain the same output with:
|
do not have access to C++23, we can obtain the same output with:
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
std::cout << std::format("<format-string>\n", <format-args>);
|
std::cout << std::format("<format-string>\n", <format-args>);
|
||||||
|
Reference in New Issue
Block a user