style: whitespaces and formatting fixed to make pre-commit happy

This commit is contained in:
Mateusz Pusz
2023-06-21 11:28:24 +02:00
parent 6a17eec09c
commit 3725db4243
8 changed files with 29 additions and 27 deletions

View File

@ -25,7 +25,7 @@ name: Documentation
on: on:
push: push:
branches: branches:
- master - master
- main - main
permissions: permissions:
contents: write contents: write
@ -37,7 +37,7 @@ jobs:
- uses: actions/setup-python@v4 - uses: actions/setup-python@v4
with: with:
python-version: 3.x python-version: 3.x
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV - run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- uses: actions/cache@v3 - uses: actions/cache@v3
with: with:
key: mkdocs-material-${{ env.cache_id }} key: mkdocs-material-${{ env.cache_id }}

View File

@ -5,4 +5,4 @@ You're not viewing the latest version.
<a href="{{ '../' ~ base_url }}"> <a href="{{ '../' ~ base_url }}">
<strong>Click here to go to latest.</strong> <strong>Click here to go to latest.</strong>
</a> </a>
{% endblock %} {% endblock %}

View File

@ -28,7 +28,7 @@ static_assert(1000 / (1 * s) == 1 * kHz);
``` ```
!!! example "[Try it on Compiler Explorer](https://godbolt.org/z/j8afKnarv)" !!! example "[Try it on Compiler Explorer](https://godbolt.org/z/j8afKnarv)"
This library requires some C++20 features ([concepts and constraints](https://en.cppreference.com/w/cpp/language/constraints), This library requires some C++20 features ([concepts and constraints](https://en.cppreference.com/w/cpp/language/constraints),
[classes as NTTP](https://en.cppreference.com/w/cpp/language/template_parameters), ...). Thanks to them, [classes as NTTP](https://en.cppreference.com/w/cpp/language/template_parameters), ...). Thanks to them,

View File

@ -6,18 +6,18 @@
To achieve that, it extensively uses C++20 features and the To achieve that, it extensively uses C++20 features and the
[explicit object parameter](https://en.cppreference.com/w/cpp/language/member_functions#Explicit_object_parameter) [explicit object parameter](https://en.cppreference.com/w/cpp/language/member_functions#Explicit_object_parameter)
from C++23. from C++23.
Even though the library benefits from C++23 (if available), C++20 is enough to compile and Even though the library benefits from C++23 (if available), C++20 is enough to compile and
use all of the library's functionality. C++23 features are hidden behind a preprocessor macro use all of the library's functionality. C++23 features are hidden behind a preprocessor macro
providing a backward-compatible way to use it. providing a backward-compatible way to use it.
Sadly, as of today, not many compilers provide full C++20 support. The library compiles fine Sadly, as of today, not many compilers provide full C++20 support. The library compiles fine
on the following compilers (or newer): on the following compilers (or newer):
- gcc-12.2 - gcc-12.2
In the upcoming weeks, we will be actively working to extend the support to other compilers as well. In the upcoming weeks, we will be actively working to extend the support to other compilers as well.
## Repository Structure and Dependencies ## Repository Structure and Dependencies
@ -286,7 +286,7 @@ To obtain an official library release, the following steps may be performed:
```ini title="conanfile.txt" ```ini title="conanfile.txt"
[requires] [requires]
mp-units/0.8.0 mp-units/0.8.0
[layout] [layout]
cmake_layout cmake_layout

View File

@ -73,4 +73,4 @@ auto speed = 60 * kmph;
!!! note !!! note
In case you wonder why this library does not use UDLs to create quantities, please check In case you wonder why this library does not use UDLs to create quantities, please check
our [FAQ](../faq/#why-dont-we-use-udls-to-create-quantities). our [FAQ](../faq/#why-dont-we-use-udls-to-create-quantities).

View File

@ -19,14 +19,14 @@ The library source code is hosted on [GitHub](https://github.com/mpusz/mp-units)
To achieve that, it extensively uses C++20 features and the To achieve that, it extensively uses C++20 features and the
[explicit object parameter](https://en.cppreference.com/w/cpp/language/member_functions#Explicit_object_parameter) [explicit object parameter](https://en.cppreference.com/w/cpp/language/member_functions#Explicit_object_parameter)
from C++23. from C++23.
Even though the library benefits from C++23 (if available), C++20 is enough to compile and Even though the library benefits from C++23 (if available), C++20 is enough to compile and
use all of the library's functionality. C++23 features are hidden behind a preprocessor macro use all of the library's functionality. C++23 features are hidden behind a preprocessor macro
providing a backward-compatible way to use it. providing a backward-compatible way to use it.
Sadly, as of today, only a few compilers provide full C++20 support. The library compiles fine Sadly, as of today, only a few compilers provide full C++20 support. The library compiles fine
on the following compilers (or newer): on the following compilers (or newer):
- gcc-12.2 - gcc-12.2
In the upcoming weeks, we will be actively working to extend the support to other compilers as well. In the upcoming weeks, we will be actively working to extend the support to other compilers as well.

View File

@ -185,22 +185,22 @@ Let's see another example:
#include <mp-units/math.h> #include <mp-units/math.h>
#include <mp-units/systems/si/si.h> #include <mp-units/systems/si/si.h>
#include <numbers> #include <numbers>
using namespace mp_units; using namespace mp_units;
class StorageTank { class StorageTank {
quantity<square(si::metre)> base_; quantity<square(si::metre)> base_;
quantity<si::metre> height_; quantity<si::metre> height_;
public: public:
constexpr StorageTank(const quantity<square(si::metre)>& base, constexpr StorageTank(const quantity<square(si::metre)>& base,
const quantity<si::metre>& height) : const quantity<si::metre>& height) :
base_(base), height_(height) base_(base), height_(height)
{ {
} }
// ... // ...
}; };
class CylindricalStorageTank : public StorageTank { class CylindricalStorageTank : public StorageTank {
public: public:
constexpr CylindricalStorageTank(const quantity<si::metre>& radius, constexpr CylindricalStorageTank(const quantity<si::metre>& radius,
@ -209,7 +209,7 @@ Let's see another example:
{ {
} }
}; };
class RectangularStorageTank : public StorageTank { class RectangularStorageTank : public StorageTank {
public: public:
constexpr RectangularStorageTank(const quantity<si::metre>& length, constexpr RectangularStorageTank(const quantity<si::metre>& length,
@ -219,7 +219,7 @@ Let's see another example:
{ {
} }
}; };
int main() int main()
{ {
using namespace mp_units::si::unit_symbols; using namespace mp_units::si::unit_symbols;
@ -235,7 +235,7 @@ Let's see another example:
#include <mp-units/systems/isq/space_and_time.h> #include <mp-units/systems/isq/space_and_time.h>
#include <mp-units/systems/si/si.h> #include <mp-units/systems/si/si.h>
#include <numbers> #include <numbers>
using namespace mp_units; using namespace mp_units;
using namespace mp_units::si::unit_symbols; using namespace mp_units::si::unit_symbols;
@ -257,10 +257,10 @@ Let's see another example:
base_(base), height_(height) base_(base), height_(height)
{ {
} }
// ... // ...
}; };
class CylindricalStorageTank : public StorageTank { class CylindricalStorageTank : public StorageTank {
public: public:
constexpr CylindricalStorageTank(const quantity<isq::radius[m]>& radius, constexpr CylindricalStorageTank(const quantity<isq::radius[m]>& radius,
@ -270,7 +270,7 @@ Let's see another example:
{ {
} }
}; };
class RectangularStorageTank : public StorageTank { class RectangularStorageTank : public StorageTank {
public: public:
constexpr RectangularStorageTank(const quantity<horizontal_length[m]>& length, constexpr RectangularStorageTank(const quantity<horizontal_length[m]>& length,
@ -280,7 +280,7 @@ Let's see another example:
{ {
} }
}; };
int main() int main()
{ {
auto tank = RectangularStorageTank(horizontal_length(1'000 * mm), auto tank = RectangularStorageTank(horizontal_length(1'000 * mm),

View File

@ -145,7 +145,8 @@ static_assert(unit_symbol(kilogram * metre / square(second), {.solidus = always}
static_assert(unit_symbol(kilogram * metre / square(second), {.encoding = ascii, .solidus = always}) == "kg m/s^2"); static_assert(unit_symbol(kilogram * metre / square(second), {.encoding = ascii, .solidus = always}) == "kg m/s^2");
static_assert(unit_symbol(kilogram * metre / square(second), {.solidus = never}) == "kg m s⁻²"); static_assert(unit_symbol(kilogram * metre / square(second), {.solidus = never}) == "kg m s⁻²");
static_assert(unit_symbol(kilogram * metre / square(second), {.encoding = ascii, .solidus = never}) == "kg m s^-2"); static_assert(unit_symbol(kilogram * metre / square(second), {.encoding = ascii, .solidus = never}) == "kg m s^-2");
static_assert(unit_symbol(kilogram * metre / square(second), {.solidus = never, .separator = half_high_dot}) == "kg⋅m⋅s⁻²"); static_assert(unit_symbol(kilogram * metre / square(second), {.solidus = never, .separator = half_high_dot}) ==
"kg⋅m⋅s⁻²");
static_assert(unit_symbol(kilogram / metre / square(second)) == "kg m⁻¹ s⁻²"); static_assert(unit_symbol(kilogram / metre / square(second)) == "kg m⁻¹ s⁻²");
static_assert(unit_symbol(kilogram / metre / square(second), {.separator = half_high_dot}) == "kg⋅m⁻¹⋅s⁻²"); static_assert(unit_symbol(kilogram / metre / square(second), {.separator = half_high_dot}) == "kg⋅m⁻¹⋅s⁻²");
static_assert(unit_symbol(kilogram / metre / square(second), {.encoding = ascii}) == "kg m^-1 s^-2"); static_assert(unit_symbol(kilogram / metre / square(second), {.encoding = ascii}) == "kg m^-1 s^-2");
@ -153,7 +154,8 @@ static_assert(unit_symbol(kilogram / metre / square(second), {.solidus = always}
static_assert(unit_symbol(kilogram / metre / square(second), {.encoding = ascii, .solidus = always}) == "kg/(m s^2)"); static_assert(unit_symbol(kilogram / metre / square(second), {.encoding = ascii, .solidus = always}) == "kg/(m s^2)");
static_assert(unit_symbol(kilogram / metre / square(second), {.solidus = never}) == "kg m⁻¹ s⁻²"); static_assert(unit_symbol(kilogram / metre / square(second), {.solidus = never}) == "kg m⁻¹ s⁻²");
static_assert(unit_symbol(kilogram / metre / square(second), {.encoding = ascii, .solidus = never}) == "kg m^-1 s^-2"); static_assert(unit_symbol(kilogram / metre / square(second), {.encoding = ascii, .solidus = never}) == "kg m^-1 s^-2");
static_assert(unit_symbol(kilogram / metre / square(second), {.solidus = never, .separator = half_high_dot}) == "kg⋅m⁻¹⋅s⁻²"); static_assert(unit_symbol(kilogram / metre / square(second), {.solidus = never, .separator = half_high_dot}) ==
"kg⋅m⁻¹⋅s⁻²");
static_assert(unit_symbol(pow<123>(metre)) == "m¹²³"); static_assert(unit_symbol(pow<123>(metre)) == "m¹²³");
static_assert(unit_symbol(pow<1, 2>(metre)) == "m^(1/2)"); static_assert(unit_symbol(pow<1, 2>(metre)) == "m^(1/2)");
static_assert(unit_symbol(pow<3, 5>(metre)) == "m^(3/5)"); static_assert(unit_symbol(pow<3, 5>(metre)) == "m^(3/5)");