mirror of
https://github.com/mpusz/mp-units.git
synced 2025-07-29 18:07:16 +02:00
dimension_ prefix removed from names of derived dimensions
This commit is contained in:
@ -3,7 +3,7 @@
|
||||
[](https://ci.appveyor.com/project/mpusz/units)
|
||||
[ ](https://bintray.com/mpusz/conan-mpusz/mp-units%3Ampusz/_latestVersion)
|
||||
|
||||
# `units` - Physical Units Library for C++
|
||||
# `units` - A Units Library for C++
|
||||
|
||||
## Summary
|
||||
|
||||
@ -66,6 +66,7 @@ NOTE: This library as of now compiles correctly only with gcc-9.1 and newer.
|
||||
- `meter` renamed to `metre`
|
||||
- Missing `operator*` added
|
||||
- Predefined dimensions moved to a dedicated directory
|
||||
- `dimension_` prefix removed from names of derived dimensions
|
||||
|
||||
- 0.2.0 July 18, 2019
|
||||
- Added C++20 features supported by gcc-9.1 (std::remove_cvref_t, down with typename, std::type_identity)
|
||||
|
@ -58,7 +58,7 @@ There are C++ concepts provided for each such quantity type:
|
||||
|
||||
```cpp
|
||||
template<typename T>
|
||||
concept Length = Quantity<T> && std::Same<typename T::dimension, dimension_length>;
|
||||
concept Length = Quantity<T> && std::Same<typename T::dimension, length>;
|
||||
```
|
||||
|
||||
With that we can easily write a function template like this:
|
||||
@ -158,10 +158,10 @@ template<Exponent... Es>
|
||||
using make_dimension_t = make_dimension<Es...>::type;
|
||||
```
|
||||
|
||||
So for example to create a `dimension_velocity` type we have to do:
|
||||
So for example to create a `velocity` type we have to do:
|
||||
|
||||
```cpp
|
||||
struct dimension_velocity : make_dimension_t<exp<base_dim_length, 1>, exp<base_dim_time, -1>> {};
|
||||
struct velocity : make_dimension_t<exp<base_dim_length, 1>, exp<base_dim_time, -1>> {};
|
||||
```
|
||||
|
||||
In order to make `make_dimension_t` work as expected it has to provide unique ordering for
|
||||
@ -323,7 +323,7 @@ could generate a following compile time error:
|
||||
^~~~
|
||||
In file included from <path>\example\example.cpp:23:
|
||||
<path>/src/include/units/si/velocity.h:41:16: note: within 'template<class T> concept const bool stde::units::Velocity<T> [with T = stde::units::quantity<units::unit<units::dimension<units::exp<units::base_dim_time, 1> >, std::ratio<1> >, long long int>]'
|
||||
concept Velocity = Quantity<T> && std::Same<typename T::dimension, dimension_velocity>;
|
||||
concept Velocity = Quantity<T> && std::Same<typename T::dimension, velocity>;
|
||||
^~~~~~~~
|
||||
In file included from <path>/src/include/units/bits/tools.h:25,
|
||||
from <path>/src/include/units/dimension.h:25,
|
||||
@ -360,14 +360,14 @@ same code will result with such an error:
|
||||
^~~~
|
||||
In file included from <path>\example\example.cpp:23:
|
||||
<path>/src/include/units/si/velocity.h:48:16: note: within 'template<class T> concept const bool stde::units::Velocity<T> [with T = stde::units::quantity<units::second, long long int>]'
|
||||
concept Velocity = Quantity<T> && std::Same<typename T::dimension, dimension_velocity>;
|
||||
concept Velocity = Quantity<T> && std::Same<typename T::dimension, velocity>;
|
||||
^~~~~~~~
|
||||
In file included from <path>/src/include/units/bits/tools.h:25,
|
||||
from <path>/src/include/units/dimension.h:25,
|
||||
from <path>/src/include/units/si/base_dimensions.h:25,
|
||||
from <path>/src/include/units/si/velocity.h:25,
|
||||
from <path>\example\example.cpp:23:
|
||||
<path>/src/include/units/bits/stdconcepts.h:33:18: note: within 'template<class T, class U> concept const bool std::Same<T, U> [with T = stde::units::dimension_time; U = stde::units::dimension_velocity]'
|
||||
<path>/src/include/units/bits/stdconcepts.h:33:18: note: within 'template<class T, class U> concept const bool std::Same<T, U> [with T = stde::units::time; U = stde::units::velocity]'
|
||||
concept Same = std::is_same_v<T, U>;
|
||||
^~~~
|
||||
<path>/src/include/units/bits/stdconcepts.h:33:18: note: 'std::is_same_v' evaluated to false
|
||||
@ -382,7 +382,7 @@ Now
|
||||
and
|
||||
|
||||
```text
|
||||
[with T = stde::units::dimension_time; U = stde::units::dimension_velocity]
|
||||
[with T = stde::units::time; U = stde::units::velocity]
|
||||
```
|
||||
|
||||
are not arguably much easier to understand thus provide better user experience.
|
||||
@ -419,12 +419,12 @@ using downcasting_traits_t = downcasting_traits<T>::type;
|
||||
With that the downcasting functionality is enabled by:
|
||||
|
||||
```cpp
|
||||
struct dimension_length : make_dimension_t<exp<base_dim_length, 1>> {};
|
||||
template<> struct downcasting_traits<downcast_from<dimension_length>> : downcast_to<dimension_length> {};
|
||||
struct length : make_dimension_t<exp<base_dim_length, 1>> {};
|
||||
template<> struct downcasting_traits<downcast_from<length>> : downcast_to<length> {};
|
||||
```
|
||||
|
||||
```cpp
|
||||
struct kilometre : unit<dimension_length, std::kilo> {};
|
||||
struct kilometre : unit<length, std::kilo> {};
|
||||
template<> struct downcasting_traits<downcast_from<kilometre>> : downcast_to<kilometre> {};
|
||||
```
|
||||
|
||||
@ -436,15 +436,15 @@ In order to extend the library with custom dimensions the user has to:
|
||||
downcasting trait for it:
|
||||
|
||||
```cpp
|
||||
struct dimension_velocity : make_dimension_t<exp<base_dim_length, 1>, exp<base_dim_time, -1>> {};
|
||||
template<> struct downcasting_traits<downcast_from<dimension_velocity>> : downcast_to<dimension_velocity> {};
|
||||
struct velocity : make_dimension_t<exp<base_dim_length, 1>, exp<base_dim_time, -1>> {};
|
||||
template<> struct downcasting_traits<downcast_from<velocity>> : downcast_to<velocity> {};
|
||||
```
|
||||
|
||||
2. Define a concept that will match a new dimension:
|
||||
|
||||
```cpp
|
||||
template<typename T>
|
||||
concept Velocity = Quantity<T> && std::Same<typename T::dimension, dimension_velocity>;
|
||||
concept Velocity = Quantity<T> && std::Same<typename T::dimension, velocity>;
|
||||
```
|
||||
|
||||
3. Define units and provide downcasting traits for them:
|
||||
@ -452,7 +452,7 @@ concept Velocity = Quantity<T> && std::Same<typename T::dimension, dimension_vel
|
||||
- base unit
|
||||
|
||||
```cpp
|
||||
struct metre : unit<dimension_length, std::ratio<1>> {};
|
||||
struct metre : unit<length, std::ratio<1>> {};
|
||||
template<> struct downcasting_traits<downcast_from<metre>> : downcast_to<metre> {};
|
||||
```
|
||||
|
||||
@ -466,7 +466,7 @@ template<> struct downcasting_traits<downcast_from<kilometre>> : downcast_to<kil
|
||||
- derived units
|
||||
|
||||
```cpp
|
||||
struct kilometre_per_hour : derived_unit<dimension_velocity, kilometre, hour> {};
|
||||
struct kilometre_per_hour : derived_unit<velocity, kilometre, hour> {};
|
||||
template<> struct downcasting_traits<downcast_from<kilometre_per_hour>> : downcast_to<kilometre_per_hour> {};
|
||||
```
|
||||
|
||||
|
@ -26,13 +26,13 @@
|
||||
|
||||
namespace std::experimental::units {
|
||||
|
||||
struct dimension_acceleration : make_dimension_t<exp<base_dim_length, 1>, exp<base_dim_time, -2>> {};
|
||||
template<> struct downcasting_traits<downcast_from<dimension_acceleration>> : downcast_to<dimension_acceleration> {};
|
||||
struct acceleration : make_dimension_t<exp<base_dim_length, 1>, exp<base_dim_time, -2>> {};
|
||||
template<> struct downcasting_traits<downcast_from<acceleration>> : downcast_to<acceleration> {};
|
||||
|
||||
template<typename T>
|
||||
concept bool Acceleration = Quantity<T> && std::Same<typename T::dimension, dimension_acceleration>;
|
||||
concept bool Acceleration = Quantity<T> && std::Same<typename T::dimension, acceleration>;
|
||||
|
||||
struct metre_per_second_sq : derived_unit<dimension_acceleration, metre, second> {};
|
||||
struct metre_per_second_sq : derived_unit<acceleration, metre, second> {};
|
||||
template<> struct downcasting_traits<downcast_from<metre_per_second_sq>> : downcast_to<metre_per_second_sq> {};
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -26,25 +26,25 @@
|
||||
|
||||
namespace std::experimental::units {
|
||||
|
||||
struct dimension_area : make_dimension_t<exp<base_dim_length, 2>> {};
|
||||
template<> struct downcasting_traits<downcast_from<dimension_area>> : downcast_to<dimension_area> {};
|
||||
struct area : make_dimension_t<exp<base_dim_length, 2>> {};
|
||||
template<> struct downcasting_traits<downcast_from<area>> : downcast_to<area> {};
|
||||
|
||||
template<typename T>
|
||||
concept bool Area = Quantity<T> && std::Same<typename T::dimension, dimension_area>;
|
||||
concept bool Area = Quantity<T> && std::Same<typename T::dimension, area>;
|
||||
|
||||
struct square_millimetre : derived_unit<dimension_area, millimetre> {};
|
||||
struct square_millimetre : derived_unit<area, millimetre> {};
|
||||
template<> struct downcasting_traits<downcast_from<square_millimetre>> : downcast_to<square_millimetre> {};
|
||||
|
||||
struct square_centimetre : derived_unit<dimension_area, centimetre> {};
|
||||
struct square_centimetre : derived_unit<area, centimetre> {};
|
||||
template<> struct downcasting_traits<downcast_from<square_centimetre>> : downcast_to<square_centimetre> {};
|
||||
|
||||
struct square_metre : derived_unit<dimension_area, metre> {};
|
||||
struct square_metre : derived_unit<area, metre> {};
|
||||
template<> struct downcasting_traits<downcast_from<square_metre>> : downcast_to<square_metre> {};
|
||||
|
||||
struct square_kilometre : derived_unit<dimension_area, kilometre, metre> {};
|
||||
struct square_kilometre : derived_unit<area, kilometre, metre> {};
|
||||
template<> struct downcasting_traits<downcast_from<square_kilometre>> : downcast_to<square_kilometre> {};
|
||||
|
||||
struct square_foot : derived_unit<dimension_area, foot> {};
|
||||
struct square_foot : derived_unit<area, foot> {};
|
||||
template<> struct downcasting_traits<downcast_from<square_foot>> : downcast_to<square_foot> {};
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -28,13 +28,13 @@
|
||||
|
||||
namespace std::experimental::units {
|
||||
|
||||
struct dimension_capacitance : make_dimension_t<exp<base_dim_mass, -1>, exp<base_dim_length, -2>, exp<base_dim_time, 4>, exp<base_dim_current, 2>> {};
|
||||
template<> struct downcasting_traits<downcast_from<dimension_capacitance>> : downcast_to<dimension_capacitance> {};
|
||||
struct capacitance : make_dimension_t<exp<base_dim_mass, -1>, exp<base_dim_length, -2>, exp<base_dim_time, 4>, exp<base_dim_current, 2>> {};
|
||||
template<> struct downcasting_traits<downcast_from<capacitance>> : downcast_to<capacitance> {};
|
||||
|
||||
template<typename T>
|
||||
concept bool Capacitance = Quantity<T> && std::Same<typename T::dimension, dimension_capacitance>;
|
||||
concept bool Capacitance = Quantity<T> && std::Same<typename T::dimension, capacitance>;
|
||||
|
||||
struct farad : derived_unit<dimension_capacitance, kilogram, metre, second, ampere> {};
|
||||
struct farad : derived_unit<capacitance, kilogram, metre, second, ampere> {};
|
||||
template<> struct downcasting_traits<downcast_from<farad>> : downcast_to<farad> {};
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -27,13 +27,13 @@
|
||||
|
||||
namespace std::experimental::units {
|
||||
|
||||
struct dimension_current : make_dimension_t<exp<base_dim_current, 1>> {};
|
||||
template<> struct downcasting_traits<downcast_from<dimension_current>> : downcast_to<dimension_current> {};
|
||||
struct current : make_dimension_t<exp<base_dim_current, 1>> {};
|
||||
template<> struct downcasting_traits<downcast_from<current>> : downcast_to<current> {};
|
||||
|
||||
template<typename T>
|
||||
concept bool Current = Quantity<T> && std::Same<typename T::dimension, dimension_current>;
|
||||
concept bool Current = Quantity<T> && std::Same<typename T::dimension, current>;
|
||||
|
||||
struct ampere : unit<dimension_current> {};
|
||||
struct ampere : unit<current> {};
|
||||
template<> struct downcasting_traits<downcast_from<ampere>> : downcast_to<ampere> {};
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -28,13 +28,13 @@
|
||||
|
||||
namespace std::experimental::units {
|
||||
|
||||
struct dimension_electric_charge : make_dimension_t<exp<base_dim_time, 1>, exp<base_dim_current, 1>> {};
|
||||
template<> struct downcasting_traits<downcast_from<dimension_electric_charge>> : downcast_to<dimension_electric_charge> {};
|
||||
struct electric_charge : make_dimension_t<exp<base_dim_time, 1>, exp<base_dim_current, 1>> {};
|
||||
template<> struct downcasting_traits<downcast_from<electric_charge>> : downcast_to<electric_charge> {};
|
||||
|
||||
template<typename T>
|
||||
concept bool ElectricCharge = Quantity<T> && std::Same<typename T::dimension, dimension_electric_charge>;
|
||||
concept bool ElectricCharge = Quantity<T> && std::Same<typename T::dimension, electric_charge>;
|
||||
|
||||
struct coulomb : derived_unit<dimension_electric_charge, second, ampere> {};
|
||||
struct coulomb : derived_unit<electric_charge, second, ampere> {};
|
||||
template<> struct downcasting_traits<downcast_from<coulomb>> : downcast_to<coulomb> {};
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -28,13 +28,13 @@
|
||||
|
||||
namespace std::experimental::units {
|
||||
|
||||
struct dimension_energy : make_dimension_t<exp<base_dim_mass, 1>, exp<base_dim_length, 2>, exp<base_dim_time, -2>> {};
|
||||
template<> struct downcasting_traits<downcast_from<dimension_energy>> : downcast_to<dimension_energy> {};
|
||||
struct energy : make_dimension_t<exp<base_dim_mass, 1>, exp<base_dim_length, 2>, exp<base_dim_time, -2>> {};
|
||||
template<> struct downcasting_traits<downcast_from<energy>> : downcast_to<energy> {};
|
||||
|
||||
template<typename T>
|
||||
concept bool Energy = Quantity<T> && std::Same<typename T::dimension, dimension_energy>;
|
||||
concept bool Energy = Quantity<T> && std::Same<typename T::dimension, energy>;
|
||||
|
||||
struct joule : derived_unit<dimension_energy, kilogram, metre, second> {};
|
||||
struct joule : derived_unit<energy, kilogram, metre, second> {};
|
||||
template<> struct downcasting_traits<downcast_from<joule>> : downcast_to<joule> {};
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -29,13 +29,13 @@
|
||||
|
||||
namespace std::experimental::units {
|
||||
|
||||
struct dimension_force : make_dimension_t<exp<base_dim_mass, 1>, exp<base_dim_length, 1>, exp<base_dim_time, -2>> {};
|
||||
template<> struct downcasting_traits<downcast_from<dimension_force>> : downcast_to<dimension_force> {};
|
||||
struct force : make_dimension_t<exp<base_dim_mass, 1>, exp<base_dim_length, 1>, exp<base_dim_time, -2>> {};
|
||||
template<> struct downcasting_traits<downcast_from<force>> : downcast_to<force> {};
|
||||
|
||||
template<typename T>
|
||||
concept bool Force = Quantity<T> && std::Same<typename T::dimension, dimension_force>;
|
||||
concept bool Force = Quantity<T> && std::Same<typename T::dimension, force>;
|
||||
|
||||
struct newton : derived_unit<dimension_force, kilogram, metre, second> {};
|
||||
struct newton : derived_unit<force, kilogram, metre, second> {};
|
||||
template<> struct downcasting_traits<downcast_from<newton>> : downcast_to<newton> {};
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -27,13 +27,13 @@
|
||||
|
||||
namespace std::experimental::units {
|
||||
|
||||
struct dimension_frequency : make_dimension_t<exp<base_dim_time, -1>> {};
|
||||
template<> struct downcasting_traits<downcast_from<dimension_frequency>> : downcast_to<dimension_frequency> {};
|
||||
struct frequency : make_dimension_t<exp<base_dim_time, -1>> {};
|
||||
template<> struct downcasting_traits<downcast_from<frequency>> : downcast_to<frequency> {};
|
||||
|
||||
template<typename T>
|
||||
concept bool Frequency = Quantity<T> && std::Same<typename T::dimension, dimension_frequency>;
|
||||
concept bool Frequency = Quantity<T> && std::Same<typename T::dimension, frequency>;
|
||||
|
||||
struct hertz : derived_unit<dimension_frequency, second> {};
|
||||
struct hertz : derived_unit<frequency, second> {};
|
||||
template<> struct downcasting_traits<downcast_from<hertz>> : downcast_to<hertz> {};
|
||||
|
||||
struct millihertz : milli<hertz> {};
|
||||
|
@ -27,14 +27,14 @@
|
||||
|
||||
namespace std::experimental::units {
|
||||
|
||||
struct dimension_length : make_dimension_t<exp<base_dim_length, 1>> {};
|
||||
template<> struct downcasting_traits<downcast_from<dimension_length>> : downcast_to<dimension_length> {};
|
||||
struct length : make_dimension_t<exp<base_dim_length, 1>> {};
|
||||
template<> struct downcasting_traits<downcast_from<length>> : downcast_to<length> {};
|
||||
|
||||
template<typename T>
|
||||
concept bool Length = Quantity<T> && std::Same<typename T::dimension, dimension_length>;
|
||||
concept bool Length = Quantity<T> && std::Same<typename T::dimension, length>;
|
||||
|
||||
// SI units
|
||||
struct metre : unit<dimension_length> {};
|
||||
struct metre : unit<length> {};
|
||||
template<> struct downcasting_traits<downcast_from<metre>> : downcast_to<metre> {};
|
||||
|
||||
struct millimetre : milli<metre> {};
|
||||
@ -67,16 +67,16 @@ namespace std::experimental::units {
|
||||
} // namespace literals
|
||||
|
||||
// US customary units
|
||||
struct yard : unit<dimension_length, ratio<9'144, 10'000>> {};
|
||||
struct yard : unit<length, ratio<9'144, 10'000>> {};
|
||||
template<> struct downcasting_traits<downcast_from<yard>> : downcast_to<yard> {};
|
||||
|
||||
struct foot : unit<dimension_length, ratio_multiply<ratio<1, 3>, yard::ratio>> {};
|
||||
struct foot : unit<length, ratio_multiply<ratio<1, 3>, yard::ratio>> {};
|
||||
template<> struct downcasting_traits<downcast_from<foot>> : downcast_to<foot> {};
|
||||
|
||||
struct inch : unit<dimension_length, ratio_multiply<ratio<1, 12>, foot::ratio>> {};
|
||||
struct inch : unit<length, ratio_multiply<ratio<1, 12>, foot::ratio>> {};
|
||||
template<> struct downcasting_traits<downcast_from<inch>> : downcast_to<inch> {};
|
||||
|
||||
struct mile : unit<dimension_length, ratio_multiply<ratio<1'760>, yard::ratio>> {};
|
||||
struct mile : unit<length, ratio_multiply<ratio<1'760>, yard::ratio>> {};
|
||||
template<> struct downcasting_traits<downcast_from<mile>> : downcast_to<mile> {};
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -27,13 +27,13 @@
|
||||
|
||||
namespace std::experimental::units {
|
||||
|
||||
struct dimension_luminous_intensity : make_dimension_t<exp<base_dim_luminous_intensity, 1>> {};
|
||||
template<> struct downcasting_traits<downcast_from<dimension_luminous_intensity>> : downcast_to<dimension_luminous_intensity> {};
|
||||
struct luminous_intensity : make_dimension_t<exp<base_dim_luminous_intensity, 1>> {};
|
||||
template<> struct downcasting_traits<downcast_from<luminous_intensity>> : downcast_to<luminous_intensity> {};
|
||||
|
||||
template<typename T>
|
||||
concept bool LuminousIntensity = Quantity<T> && std::Same<typename T::dimension, dimension_luminous_intensity>;
|
||||
concept bool LuminousIntensity = Quantity<T> && std::Same<typename T::dimension, luminous_intensity>;
|
||||
|
||||
struct candela : unit<dimension_luminous_intensity> {};
|
||||
struct candela : unit<luminous_intensity> {};
|
||||
template<> struct downcasting_traits<downcast_from<candela>> : downcast_to<candela> {};
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -27,13 +27,13 @@
|
||||
|
||||
namespace std::experimental::units {
|
||||
|
||||
struct dimension_mass : make_dimension_t<exp<base_dim_mass, 1>> {};
|
||||
template<> struct downcasting_traits<downcast_from<dimension_mass>> : downcast_to<dimension_mass> {};
|
||||
struct mass : make_dimension_t<exp<base_dim_mass, 1>> {};
|
||||
template<> struct downcasting_traits<downcast_from<mass>> : downcast_to<mass> {};
|
||||
|
||||
template<typename T>
|
||||
concept bool Mass = Quantity<T> && std::Same<typename T::dimension, dimension_mass>;
|
||||
concept bool Mass = Quantity<T> && std::Same<typename T::dimension, mass>;
|
||||
|
||||
struct gram : unit<dimension_mass, ratio<1, 1000>> {};
|
||||
struct gram : unit<mass, ratio<1, 1000>> {};
|
||||
template<> struct downcasting_traits<downcast_from<gram>> : downcast_to<gram> {};
|
||||
|
||||
struct kilogram : kilo<gram> {};
|
||||
|
@ -27,13 +27,13 @@
|
||||
|
||||
namespace std::experimental::units {
|
||||
|
||||
struct dimension_power : make_dimension_t<exp<base_dim_mass, 1>, exp<base_dim_length, 2>, exp<base_dim_time, -3>> {};
|
||||
template<> struct downcasting_traits<downcast_from<dimension_power>> : downcast_to<dimension_power> {};
|
||||
struct power : make_dimension_t<exp<base_dim_mass, 1>, exp<base_dim_length, 2>, exp<base_dim_time, -3>> {};
|
||||
template<> struct downcasting_traits<downcast_from<power>> : downcast_to<power> {};
|
||||
|
||||
template<typename T>
|
||||
concept bool Power = Quantity<T> && std::Same<typename T::dimension, dimension_power>;
|
||||
concept bool Power = Quantity<T> && std::Same<typename T::dimension, power>;
|
||||
|
||||
struct watt : derived_unit<dimension_power, kilogram, metre, second> {};
|
||||
struct watt : derived_unit<power, kilogram, metre, second> {};
|
||||
template<> struct downcasting_traits<downcast_from<watt>> : downcast_to<watt> {};
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -27,13 +27,13 @@
|
||||
|
||||
namespace std::experimental::units {
|
||||
|
||||
struct dimension_pressure : make_dimension_t<exp<base_dim_mass, 1>, exp<base_dim_length, -1>, exp<base_dim_time, -2>> {};
|
||||
template<> struct downcasting_traits<downcast_from<dimension_pressure>> : downcast_to<dimension_pressure> {};
|
||||
struct pressure : make_dimension_t<exp<base_dim_mass, 1>, exp<base_dim_length, -1>, exp<base_dim_time, -2>> {};
|
||||
template<> struct downcasting_traits<downcast_from<pressure>> : downcast_to<pressure> {};
|
||||
|
||||
template<typename T>
|
||||
concept bool Pressure = Quantity<T> && std::Same<typename T::dimension, dimension_pressure>;
|
||||
concept bool Pressure = Quantity<T> && std::Same<typename T::dimension, pressure>;
|
||||
|
||||
struct pascal : derived_unit<dimension_pressure, kilogram, metre, second> {};
|
||||
struct pascal : derived_unit<pressure, kilogram, metre, second> {};
|
||||
template<> struct downcasting_traits<downcast_from<pascal>> : downcast_to<pascal> {};
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -27,13 +27,13 @@
|
||||
|
||||
namespace std::experimental::units {
|
||||
|
||||
struct dimension_substance : make_dimension_t<exp<base_dim_substance, 1>> {};
|
||||
template<> struct downcasting_traits<downcast_from<dimension_substance>> : downcast_to<dimension_substance> {};
|
||||
struct substance : make_dimension_t<exp<base_dim_substance, 1>> {};
|
||||
template<> struct downcasting_traits<downcast_from<substance>> : downcast_to<substance> {};
|
||||
|
||||
template<typename T>
|
||||
concept bool Substance = Quantity<T> && std::Same<typename T::dimension, dimension_substance>;
|
||||
concept bool Substance = Quantity<T> && std::Same<typename T::dimension, substance>;
|
||||
|
||||
struct mole : unit<dimension_substance> {};
|
||||
struct mole : unit<substance> {};
|
||||
template<> struct downcasting_traits<downcast_from<mole>> : downcast_to<mole> {};
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -27,13 +27,13 @@
|
||||
|
||||
namespace std::experimental::units {
|
||||
|
||||
struct dimension_temperature : make_dimension_t<exp<base_dim_temperature, 1>> {};
|
||||
template<> struct downcasting_traits<downcast_from<dimension_temperature>> : downcast_to<dimension_temperature> {};
|
||||
struct temperature : make_dimension_t<exp<base_dim_temperature, 1>> {};
|
||||
template<> struct downcasting_traits<downcast_from<temperature>> : downcast_to<temperature> {};
|
||||
|
||||
template<typename T>
|
||||
concept bool ThermodynamicTemperature = Quantity<T> && std::Same<typename T::dimension, dimension_temperature>;
|
||||
concept bool ThermodynamicTemperature = Quantity<T> && std::Same<typename T::dimension, temperature>;
|
||||
|
||||
struct kelvin : unit<dimension_temperature> {};
|
||||
struct kelvin : unit<temperature> {};
|
||||
template<> struct downcasting_traits<downcast_from<kelvin>> : downcast_to<kelvin> {};
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -27,13 +27,13 @@
|
||||
|
||||
namespace std::experimental::units {
|
||||
|
||||
struct dimension_time : make_dimension_t<exp<base_dim_time, 1>> {};
|
||||
template<> struct downcasting_traits<downcast_from<dimension_time>> : downcast_to<dimension_time> {};
|
||||
struct time : make_dimension_t<exp<base_dim_time, 1>> {};
|
||||
template<> struct downcasting_traits<downcast_from<time>> : downcast_to<time> {};
|
||||
|
||||
template<typename T>
|
||||
concept bool Time = Quantity<T> && std::Same<typename T::dimension, dimension_time>;
|
||||
concept bool Time = Quantity<T> && std::Same<typename T::dimension, time>;
|
||||
|
||||
struct second : unit<dimension_time> {};
|
||||
struct second : unit<time> {};
|
||||
template<> struct downcasting_traits<downcast_from<second>> : downcast_to<second> {};
|
||||
|
||||
struct nanosecond : nano<second> {};
|
||||
@ -45,10 +45,10 @@ namespace std::experimental::units {
|
||||
struct millisecond : milli<second> {};
|
||||
template<> struct downcasting_traits<downcast_from<millisecond>> : downcast_to<millisecond> {};
|
||||
|
||||
struct minute : unit<dimension_time, ratio<60>> {};
|
||||
struct minute : unit<time, ratio<60>> {};
|
||||
template<> struct downcasting_traits<downcast_from<minute>> : downcast_to<minute> {};
|
||||
|
||||
struct hour : unit<dimension_time, ratio<3600>> {};
|
||||
struct hour : unit<time, ratio<3600>> {};
|
||||
template<> struct downcasting_traits<downcast_from<hour>> : downcast_to<hour> {};
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -27,19 +27,19 @@
|
||||
|
||||
namespace std::experimental::units {
|
||||
|
||||
struct dimension_velocity : make_dimension_t<exp<base_dim_length, 1>, exp<base_dim_time, -1>> {};
|
||||
template<> struct downcasting_traits<downcast_from<dimension_velocity>> : downcast_to<dimension_velocity> {};
|
||||
struct velocity : make_dimension_t<exp<base_dim_length, 1>, exp<base_dim_time, -1>> {};
|
||||
template<> struct downcasting_traits<downcast_from<velocity>> : downcast_to<velocity> {};
|
||||
|
||||
template<typename T>
|
||||
concept bool Velocity = Quantity<T> && std::Same<typename T::dimension, dimension_velocity>;
|
||||
concept bool Velocity = Quantity<T> && std::Same<typename T::dimension, velocity>;
|
||||
|
||||
struct metre_per_second : derived_unit<dimension_velocity, metre, second> {};
|
||||
struct metre_per_second : derived_unit<velocity, metre, second> {};
|
||||
template<> struct downcasting_traits<downcast_from<metre_per_second>> : downcast_to<metre_per_second> {};
|
||||
|
||||
struct kilometre_per_hour : derived_unit<dimension_velocity, kilometre, hour> {};
|
||||
struct kilometre_per_hour : derived_unit<velocity, kilometre, hour> {};
|
||||
template<> struct downcasting_traits<downcast_from<kilometre_per_hour>> : downcast_to<kilometre_per_hour> {};
|
||||
|
||||
struct mile_per_hour : derived_unit<dimension_velocity, mile, hour> {};
|
||||
struct mile_per_hour : derived_unit<velocity, mile, hour> {};
|
||||
template<> struct downcasting_traits<downcast_from<mile_per_hour>> : downcast_to<mile_per_hour> {};
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -30,13 +30,13 @@
|
||||
|
||||
namespace std::experimental::units {
|
||||
|
||||
struct dimension_voltage : make_dimension_t<exp<base_dim_mass, 1>, exp<base_dim_length, 2>, exp<base_dim_time, -3>, exp<base_dim_current, -1>> {};
|
||||
template<> struct downcasting_traits<downcast_from<dimension_voltage>> : downcast_to<dimension_voltage> {};
|
||||
struct voltage : make_dimension_t<exp<base_dim_mass, 1>, exp<base_dim_length, 2>, exp<base_dim_time, -3>, exp<base_dim_current, -1>> {};
|
||||
template<> struct downcasting_traits<downcast_from<voltage>> : downcast_to<voltage> {};
|
||||
|
||||
template<typename T>
|
||||
concept bool Voltage = Quantity<T> && std::Same<typename T::dimension, dimension_voltage>;
|
||||
concept bool Voltage = Quantity<T> && std::Same<typename T::dimension, voltage>;
|
||||
|
||||
struct volt : derived_unit<dimension_voltage, kilogram, metre, second, ampere> {};
|
||||
struct volt : derived_unit<voltage, kilogram, metre, second, ampere> {};
|
||||
template<> struct downcasting_traits<downcast_from<volt>> : downcast_to<volt> {};
|
||||
|
||||
inline namespace literals {
|
||||
|
@ -26,25 +26,25 @@
|
||||
|
||||
namespace std::experimental::units {
|
||||
|
||||
struct dimension_volume : make_dimension_t<exp<base_dim_length, 3>> {};
|
||||
template<> struct downcasting_traits<downcast_from<dimension_volume>> : downcast_to<dimension_volume> {};
|
||||
struct volume : make_dimension_t<exp<base_dim_length, 3>> {};
|
||||
template<> struct downcasting_traits<downcast_from<volume>> : downcast_to<volume> {};
|
||||
|
||||
template<typename T>
|
||||
concept bool Volume = Quantity<T> && std::Same<typename T::dimension, dimension_volume>;
|
||||
concept bool Volume = Quantity<T> && std::Same<typename T::dimension, volume>;
|
||||
|
||||
struct cubic_millimetre : derived_unit<dimension_volume, millimetre> {};
|
||||
struct cubic_millimetre : derived_unit<volume, millimetre> {};
|
||||
template<> struct downcasting_traits<downcast_from<cubic_millimetre>> : downcast_to<cubic_millimetre> {};
|
||||
|
||||
struct cubic_centimetre : derived_unit<dimension_volume, centimetre> {};
|
||||
struct cubic_centimetre : derived_unit<volume, centimetre> {};
|
||||
template<> struct downcasting_traits<downcast_from<cubic_centimetre>> : downcast_to<cubic_centimetre> {};
|
||||
|
||||
struct cubic_metre : derived_unit<dimension_volume, metre> {};
|
||||
struct cubic_metre : derived_unit<volume, metre> {};
|
||||
template<> struct downcasting_traits<downcast_from<cubic_metre>> : downcast_to<cubic_metre> {};
|
||||
|
||||
struct cubic_kilometre : derived_unit<dimension_volume, kilometre, metre> {};
|
||||
struct cubic_kilometre : derived_unit<volume, kilometre, metre> {};
|
||||
template<> struct downcasting_traits<downcast_from<cubic_kilometre>> : downcast_to<cubic_kilometre> {};
|
||||
|
||||
struct cubic_foot : derived_unit<dimension_volume, foot> {};
|
||||
struct cubic_foot : derived_unit<volume, foot> {};
|
||||
template<> struct downcasting_traits<downcast_from<cubic_foot>> : downcast_to<cubic_foot> {};
|
||||
|
||||
inline namespace literals {
|
||||
|
Reference in New Issue
Block a user