mirror of
https://github.com/mpusz/mp-units.git
synced 2025-07-29 18:07:16 +02:00
feat(example): is_vector
specialization no longer needed for si_constants
This commit is contained in:
@ -16,19 +16,11 @@ work in practice.
|
|||||||
--8<-- "example/si_constants.cpp:28:40"
|
--8<-- "example/si_constants.cpp:28:40"
|
||||||
```
|
```
|
||||||
|
|
||||||
As always, we start with the inclusion of all the needed header files. After that, for
|
As always, we start with the inclusion of all the needed header files.
|
||||||
the simplicity of this example, we
|
|
||||||
[hack the character of quantities](../framework_basics/character_of_a_quantity.md#hacking-the-character)
|
|
||||||
to be able to express vector quantities with simple scalar types.
|
|
||||||
|
|
||||||
```cpp title="si_constants.cpp" linenums="14"
|
|
||||||
--8<-- "example/si_constants.cpp:42:44"
|
|
||||||
```
|
|
||||||
|
|
||||||
The main part of the example prints all of the SI-defining constants:
|
The main part of the example prints all of the SI-defining constants:
|
||||||
|
|
||||||
```cpp title="si_constants.cpp" linenums="17"
|
```cpp title="si_constants.cpp" linenums="14"
|
||||||
--8<-- "example/si_constants.cpp:45:"
|
--8<-- "example/si_constants.cpp:42:"
|
||||||
```
|
```
|
||||||
|
|
||||||
While analyzing the output of this program (provided below), we can easily notice that a direct
|
While analyzing the output of this program (provided below), we can easily notice that a direct
|
||||||
|
@ -39,10 +39,6 @@ import mp_units;
|
|||||||
#include <mp-units/systems/si.h>
|
#include <mp-units/systems/si.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
template<class T>
|
|
||||||
requires mp_units::is_scalar<T>
|
|
||||||
constexpr bool mp_units::is_vector<T> = true;
|
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
using namespace mp_units;
|
using namespace mp_units;
|
||||||
|
Reference in New Issue
Block a user