mirror of
https://github.com/mpusz/mp-units.git
synced 2025-07-31 10:57:16 +02:00
units
removed from a std::experimental
namespace
This commit is contained in:
@ -57,7 +57,7 @@ NOTE: This library as of now compiles correctly only with gcc-9.1 and newer.
|
||||
## Release notes
|
||||
|
||||
- 0.4.0 ???
|
||||
-
|
||||
- `units` removed from a `std::experimental` namespace
|
||||
|
||||
- 0.3.1 Sep 18, 2019
|
||||
- cmcstl2 dependency changed to range-v3 0.9.1
|
||||
|
@ -51,7 +51,7 @@ Quantity is a concrete amount of a unit for a specified dimension with a specifi
|
||||
|
||||
```cpp
|
||||
units::quantity<units::kilometre, double> d1(123);
|
||||
auto d2 = 123km; // stde::units::quantity<units::kilometre, std::int64_t>
|
||||
auto d2 = 123km; // units::quantity<units::kilometre, std::int64_t>
|
||||
```
|
||||
|
||||
There are C++ concepts provided for each such quantity type:
|
||||
@ -385,7 +385,7 @@ could generate a following compile time error:
|
||||
const Velocity auto t = 20s;
|
||||
^~~~
|
||||
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>]'
|
||||
<path>/src/include/units/si/velocity.h:41:16: note: within 'template<class T> concept const bool units::Velocity<T> [with T = 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_as<typename T::dimension, velocity>;
|
||||
^~~~~~~~
|
||||
In file included from <path>/src/include/units/bits/tools.h:25,
|
||||
@ -393,7 +393,7 @@ In file included from <path>/src/include/units/bits/tools.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_as<T, U> [with T = stde::units::dimension<units::exp<units::base_dim_time, 1> >; U = stde::units::dimension<units::exp<units::base_dim_length, 1>,stde::units::exp<units::base_dim_time, -1> >]'
|
||||
<path>/src/include/units/bits/stdconcepts.h:33:18: note: within 'template<class T, class U> concept const bool std::same_as<T, U> [with T = units::dimension<units::exp<units::base_dim_time, 1> >; U = units::dimension<units::exp<units::base_dim_length, 1>,units::exp<units::base_dim_time, -1> >]'
|
||||
concept same_as = std::is_same_v<T, U>;
|
||||
^~~~
|
||||
<path>/src/include/units/bits/stdconcepts.h:33:18: note: 'std::is_same_v' evaluated to false
|
||||
@ -403,13 +403,13 @@ Time and velocity are not that complicated dimensions and there are much more co
|
||||
out there, but even for those dimensions
|
||||
|
||||
```text
|
||||
[with T = stde::units::quantity<units::unit<units::dimension<units::exp<units::base_dim_time, 1> >, std::ratio<1> >, long long int>]
|
||||
[with T = units::quantity<units::unit<units::dimension<units::exp<units::base_dim_time, 1> >, std::ratio<1> >, long long int>]
|
||||
```
|
||||
|
||||
and
|
||||
|
||||
```text
|
||||
[with T = stde::units::dimension<units::exp<units::base_dim_time, 1> >; U = stde::units::dimension<units::exp<units::base_dim_length, 1>,stde::units::exp<units::base_dim_time, -1> >]
|
||||
[with T = units::dimension<units::exp<units::base_dim_time, 1> >; U = units::dimension<units::exp<units::base_dim_length, 1>,units::exp<units::base_dim_time, -1> >]
|
||||
```
|
||||
|
||||
starts to be really hard to analyze or debug.
|
||||
@ -422,7 +422,7 @@ same code will result with such an error:
|
||||
const Velocity t = 20s;
|
||||
^~~~
|
||||
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>]'
|
||||
<path>/src/include/units/si/velocity.h:48:16: note: within 'template<class T> concept const bool units::Velocity<T> [with T = units::quantity<units::second, long long int>]'
|
||||
concept Velocity = Quantity<T> && std::same_as<typename T::dimension, velocity>;
|
||||
^~~~~~~~
|
||||
In file included from <path>/src/include/units/bits/tools.h:25,
|
||||
@ -430,7 +430,7 @@ In file included from <path>/src/include/units/bits/tools.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_as<T, U> [with T = stde::units::time; U = stde::units::velocity]'
|
||||
<path>/src/include/units/bits/stdconcepts.h:33:18: note: within 'template<class T, class U> concept const bool std::same_as<T, U> [with T = units::time; U = units::velocity]'
|
||||
concept same_as = std::is_same_v<T, U>;
|
||||
^~~~
|
||||
<path>/src/include/units/bits/stdconcepts.h:33:18: note: 'std::is_same_v' evaluated to false
|
||||
@ -439,13 +439,13 @@ In file included from <path>/src/include/units/bits/tools.h:25,
|
||||
Now
|
||||
|
||||
```text
|
||||
[with T = stde::units::quantity<units::second, long long int>]
|
||||
[with T = units::quantity<units::second, long long int>]
|
||||
```
|
||||
|
||||
and
|
||||
|
||||
```text
|
||||
[with T = stde::units::time; U = stde::units::velocity]
|
||||
[with T = units::time; U = units::velocity]
|
||||
```
|
||||
|
||||
are not arguably much easier to understand thus provide better user experience.
|
||||
|
@ -25,28 +25,27 @@
|
||||
|
||||
namespace {
|
||||
|
||||
namespace stde = std::experimental;
|
||||
using namespace stde::units::literals;
|
||||
using namespace units::literals;
|
||||
|
||||
template<stde::units::Length D, stde::units::Time T>
|
||||
constexpr stde::units::Velocity avg_speed(D d, T t)
|
||||
template<units::Length D, units::Time T>
|
||||
constexpr units::Velocity avg_speed(D d, T t)
|
||||
{
|
||||
return d / t;
|
||||
}
|
||||
|
||||
template<stde::units::Velocity V, stde::units::Time T>
|
||||
template<units::Velocity V, units::Time T>
|
||||
void example_1(V v, T t)
|
||||
{
|
||||
const stde::units::Length distance = v * t;
|
||||
const units::Length distance = v * t;
|
||||
std::cout << "A car driving " << v.count() << " km/h in a time of " << t.count() << " minutes will pass "
|
||||
<< stde::units::quantity_cast<stde::units::quantity<stde::units::metre, double>>(distance).count() << " metres.\n";
|
||||
<< units::quantity_cast<units::quantity<units::metre, double>>(distance).count() << " metres.\n";
|
||||
}
|
||||
|
||||
void example_2(double distance_v, double duration_v)
|
||||
{
|
||||
stde::units::quantity<stde::units::kilometre> distance(distance_v);
|
||||
stde::units::quantity<stde::units::hour> duration(duration_v);
|
||||
const auto kmph = quantity_cast<stde::units::kilometre_per_hour>(avg_speed(distance, duration));
|
||||
units::quantity<units::kilometre> distance(distance_v);
|
||||
units::quantity<units::hour> duration(duration_v);
|
||||
const auto kmph = quantity_cast<units::kilometre_per_hour>(avg_speed(distance, duration));
|
||||
std::cout << "Average speed of a car that makes " << distance.count() << " km in "
|
||||
<< duration.count() << " hours is " << kmph.count() << " km/h.\n";
|
||||
}
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#include <units/bits/hacks.h>
|
||||
|
||||
namespace std::experimental::units {
|
||||
namespace units {
|
||||
|
||||
template<typename T>
|
||||
concept bool Number = std::regular<T> &&
|
||||
@ -43,4 +43,4 @@ namespace std::experimental::units {
|
||||
// …
|
||||
};
|
||||
|
||||
} // namespace std::experimental::units
|
||||
} // namespace units
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include <units/bits/hacks.h>
|
||||
#include <type_traits>
|
||||
|
||||
namespace std::experimental::units {
|
||||
namespace units {
|
||||
|
||||
template<typename BaseType>
|
||||
struct downcast_base {
|
||||
@ -51,4 +51,4 @@ namespace std::experimental::units {
|
||||
template<Downcastable T>
|
||||
using downcasting_traits_t = downcasting_traits<T>::type;
|
||||
|
||||
} // namespace std::experimental::units
|
||||
} // namespace units
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#include <units/bits/type_traits.h>
|
||||
|
||||
namespace std::experimental::units {
|
||||
namespace units {
|
||||
|
||||
namespace detail {
|
||||
|
||||
@ -182,4 +182,4 @@ namespace std::experimental::units {
|
||||
template<TypeList List, template<typename, typename> typename Pred>
|
||||
using type_list_sort = detail::type_list_sort_impl<List, Pred>::type;
|
||||
|
||||
} // namespace std::experimental::units
|
||||
} // namespace units
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
namespace std::experimental::units {
|
||||
namespace units {
|
||||
|
||||
namespace detail {
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include <units/ratio.h>
|
||||
#include <ratio>
|
||||
|
||||
namespace std::experimental::units {
|
||||
namespace units {
|
||||
|
||||
template<typename T>
|
||||
concept bool BaseDimension = std::is_empty_v<T> &&
|
||||
@ -286,4 +286,4 @@ namespace std::experimental::units {
|
||||
template<Dimension D, std::size_t N>
|
||||
using dimension_pow_t = dimension_pow<typename D::base_type, N>::type;
|
||||
|
||||
} // namespace std::experimental::units
|
||||
} // namespace units
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#include <units/dimensions/velocity.h>
|
||||
|
||||
namespace std::experimental::units {
|
||||
namespace units {
|
||||
|
||||
struct acceleration : make_dimension_t<exp<velocity, 1>, exp<base_dim_time, -1>> {};
|
||||
template<> struct downcasting_traits<downcast_from<acceleration>> : downcast_to<acceleration> {};
|
||||
@ -43,4 +43,4 @@ namespace std::experimental::units {
|
||||
|
||||
} // namespace literals
|
||||
|
||||
} // namespace std::experimental::units
|
||||
} // namespace units
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#include <units/dimensions/length.h>
|
||||
|
||||
namespace std::experimental::units {
|
||||
namespace units {
|
||||
|
||||
struct area : make_dimension_t<exp<base_dim_length, 2>> {};
|
||||
template<> struct downcasting_traits<downcast_from<area>> : downcast_to<area> {};
|
||||
@ -67,4 +67,4 @@ namespace std::experimental::units {
|
||||
|
||||
} // namespace literals
|
||||
|
||||
} // namespace std::experimental::units
|
||||
} // namespace units
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#include <units/dimension.h>
|
||||
|
||||
namespace std::experimental::units {
|
||||
namespace units {
|
||||
|
||||
struct base_dim_length { static constexpr const char* value = "length"; };
|
||||
struct base_dim_mass { static constexpr const char* value = "mass"; };
|
||||
@ -34,4 +34,4 @@ namespace std::experimental::units {
|
||||
struct base_dim_substance { static constexpr const char* value = "substance"; };
|
||||
struct base_dim_luminous_intensity { static constexpr const char* value = "luminous intensity"; };
|
||||
|
||||
} // namespace std::experimental::units
|
||||
} // namespace units
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include <units/dimensions/electric_charge.h>
|
||||
#include <units/dimensions/voltage.h>
|
||||
|
||||
namespace std::experimental::units {
|
||||
namespace units {
|
||||
|
||||
struct capacitance : make_dimension_t<exp<electric_charge, 1>, exp<voltage, -1>> {};
|
||||
template<> struct downcasting_traits<downcast_from<capacitance>> : downcast_to<capacitance> {};
|
||||
@ -45,4 +45,4 @@ namespace std::experimental::units {
|
||||
|
||||
} // namespace literals
|
||||
|
||||
} // namespace std::experimental::units
|
||||
} // namespace units
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include <units/dimensions/base_dimensions.h>
|
||||
#include <units/quantity.h>
|
||||
|
||||
namespace std::experimental::units {
|
||||
namespace units {
|
||||
|
||||
struct current : make_dimension_t<exp<base_dim_current, 1>> {};
|
||||
template<> struct downcasting_traits<downcast_from<current>> : downcast_to<current> {};
|
||||
@ -44,4 +44,4 @@ namespace std::experimental::units {
|
||||
|
||||
}
|
||||
|
||||
} // namespace std::experimental::units
|
||||
} // namespace units
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include <units/dimensions/time.h>
|
||||
#include <units/dimensions/current.h>
|
||||
|
||||
namespace std::experimental::units {
|
||||
namespace units {
|
||||
|
||||
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> {};
|
||||
@ -45,4 +45,4 @@ namespace std::experimental::units {
|
||||
|
||||
} // namespace literals
|
||||
|
||||
} // namespace std::experimental::units
|
||||
} // namespace units
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include <units/dimensions/force.h>
|
||||
#include <units/dimensions/pressure.h>
|
||||
|
||||
namespace std::experimental::units {
|
||||
namespace units {
|
||||
|
||||
struct energy : make_dimension_t<exp<force, 1>, exp<length, 1>> {};
|
||||
template<> struct downcasting_traits<downcast_from<energy>> : downcast_to<energy> {};
|
||||
@ -45,4 +45,4 @@ namespace std::experimental::units {
|
||||
|
||||
} // namespace literals
|
||||
|
||||
} // namespace std::experimental::units
|
||||
} // namespace units
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include <units/dimensions/mass.h>
|
||||
#include <units/dimensions/acceleration.h>
|
||||
|
||||
namespace std::experimental::units {
|
||||
namespace units {
|
||||
|
||||
struct force : make_dimension_t<exp<base_dim_mass, 1>, exp<acceleration, 1>> {};
|
||||
template<> struct downcasting_traits<downcast_from<force>> : downcast_to<force> {};
|
||||
@ -45,4 +45,4 @@ namespace std::experimental::units {
|
||||
|
||||
} // namespace literals
|
||||
|
||||
} // namespace std::experimental::units
|
||||
} // namespace units
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include <units/dimensions/base_dimensions.h>
|
||||
#include <units/dimensions/time.h>
|
||||
|
||||
namespace std::experimental::units {
|
||||
namespace units {
|
||||
|
||||
struct frequency : make_dimension_t<exp<base_dim_time, -1>> {};
|
||||
template<> struct downcasting_traits<downcast_from<frequency>> : downcast_to<frequency> {};
|
||||
@ -79,4 +79,4 @@ namespace std::experimental::units {
|
||||
|
||||
} // namespace literals
|
||||
|
||||
} // namespace std::experimental::units
|
||||
} // namespace units
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include <units/dimensions/base_dimensions.h>
|
||||
#include <units/quantity.h>
|
||||
|
||||
namespace std::experimental::units {
|
||||
namespace units {
|
||||
|
||||
struct length : make_dimension_t<exp<base_dim_length, 1>> {};
|
||||
template<> struct downcasting_traits<downcast_from<length>> : downcast_to<length> {};
|
||||
@ -99,4 +99,4 @@ namespace std::experimental::units {
|
||||
|
||||
} // namespace literals
|
||||
|
||||
} // namespace std::experimental::units
|
||||
} // namespace units
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include <units/dimensions/base_dimensions.h>
|
||||
#include <units/quantity.h>
|
||||
|
||||
namespace std::experimental::units {
|
||||
namespace units {
|
||||
|
||||
struct luminous_intensity : make_dimension_t<exp<base_dim_luminous_intensity, 1>> {};
|
||||
template<> struct downcasting_traits<downcast_from<luminous_intensity>> : downcast_to<luminous_intensity> {};
|
||||
@ -44,4 +44,4 @@ namespace std::experimental::units {
|
||||
|
||||
} // namespace literals
|
||||
|
||||
} // namespace std::experimental::units
|
||||
} // namespace units
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include <units/dimensions/base_dimensions.h>
|
||||
#include <units/quantity.h>
|
||||
|
||||
namespace std::experimental::units {
|
||||
namespace units {
|
||||
|
||||
struct mass : make_dimension_t<exp<base_dim_mass, 1>> {};
|
||||
template<> struct downcasting_traits<downcast_from<mass>> : downcast_to<mass> {};
|
||||
@ -51,4 +51,4 @@ namespace std::experimental::units {
|
||||
|
||||
} // namespace literals
|
||||
|
||||
} // namespace std::experimental::units
|
||||
} // namespace units
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include <units/dimensions/base_dimensions.h>
|
||||
#include <units/dimensions/energy.h>
|
||||
|
||||
namespace std::experimental::units {
|
||||
namespace units {
|
||||
|
||||
struct power : make_dimension_t<exp<energy, 1>, exp<base_dim_time, -1>> {};
|
||||
template<> struct downcasting_traits<downcast_from<power>> : downcast_to<power> {};
|
||||
@ -44,4 +44,4 @@ namespace std::experimental::units {
|
||||
|
||||
} // namespace literals
|
||||
|
||||
} // namespace std::experimental::units
|
||||
} // namespace units
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include <units/dimensions/force.h>
|
||||
#include <units/dimensions/area.h>
|
||||
|
||||
namespace std::experimental::units {
|
||||
namespace units {
|
||||
|
||||
struct pressure : make_dimension_t<exp<force, 1>, exp<area, -1>> {};
|
||||
template<> struct downcasting_traits<downcast_from<pressure>> : downcast_to<pressure> {};
|
||||
@ -45,4 +45,4 @@ namespace std::experimental::units {
|
||||
|
||||
} // namespace literals
|
||||
|
||||
} // namespace std::experimental::units
|
||||
} // namespace units
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include <units/dimensions/base_dimensions.h>
|
||||
#include <units/quantity.h>
|
||||
|
||||
namespace std::experimental::units {
|
||||
namespace units {
|
||||
|
||||
struct substance : make_dimension_t<exp<base_dim_substance, 1>> {};
|
||||
template<> struct downcasting_traits<downcast_from<substance>> : downcast_to<substance> {};
|
||||
@ -44,4 +44,4 @@ namespace std::experimental::units {
|
||||
|
||||
} // namespace literals
|
||||
|
||||
} // namespace std::experimental::units
|
||||
} // namespace units
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include <units/dimensions/base_dimensions.h>
|
||||
#include <units/quantity.h>
|
||||
|
||||
namespace std::experimental::units {
|
||||
namespace units {
|
||||
|
||||
struct temperature : make_dimension_t<exp<base_dim_temperature, 1>> {};
|
||||
template<> struct downcasting_traits<downcast_from<temperature>> : downcast_to<temperature> {};
|
||||
@ -44,4 +44,4 @@ namespace std::experimental::units {
|
||||
|
||||
} // namespace literals
|
||||
|
||||
} // namespace std::experimental::units
|
||||
} // namespace units
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include <units/dimensions/base_dimensions.h>
|
||||
#include <units/quantity.h>
|
||||
|
||||
namespace std::experimental::units {
|
||||
namespace units {
|
||||
|
||||
struct time : make_dimension_t<exp<base_dim_time, 1>> {};
|
||||
template<> struct downcasting_traits<downcast_from<time>> : downcast_to<time> {};
|
||||
@ -79,4 +79,4 @@ namespace std::experimental::units {
|
||||
|
||||
} // namespace literals
|
||||
|
||||
} // namespace std::experimental::units
|
||||
} // namespace units
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include <units/dimensions/length.h>
|
||||
#include <units/dimensions/time.h>
|
||||
|
||||
namespace std::experimental::units {
|
||||
namespace units {
|
||||
|
||||
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> {};
|
||||
@ -58,4 +58,4 @@ namespace std::experimental::units {
|
||||
|
||||
} // namespace literals
|
||||
|
||||
} // namespace std::experimental::units
|
||||
} // namespace units
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include <units/dimensions/energy.h>
|
||||
#include <units/dimensions/electric_charge.h>
|
||||
|
||||
namespace std::experimental::units {
|
||||
namespace units {
|
||||
|
||||
struct voltage : make_dimension_t<exp<power, 1>, exp<base_dim_current, -1>> {};
|
||||
template<> struct downcasting_traits<downcast_from<voltage>> : downcast_to<voltage> {};
|
||||
@ -47,4 +47,4 @@ namespace std::experimental::units {
|
||||
|
||||
} // namespace literals
|
||||
|
||||
} // namespace std::experimental::units
|
||||
} // namespace units
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#include <units/dimensions/length.h>
|
||||
|
||||
namespace std::experimental::units {
|
||||
namespace units {
|
||||
|
||||
struct volume : make_dimension_t<exp<base_dim_length, 3>> {};
|
||||
template<> struct downcasting_traits<downcast_from<volume>> : downcast_to<volume> {};
|
||||
@ -67,4 +67,4 @@ namespace std::experimental::units {
|
||||
|
||||
} // namespace literals
|
||||
|
||||
} // namespace std::experimental::units
|
||||
} // namespace units
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include <units/quantity.h>
|
||||
#include <cmath>
|
||||
|
||||
namespace std::experimental::units {
|
||||
namespace units {
|
||||
|
||||
template<std::size_t N, typename U, typename Rep>
|
||||
inline Quantity pow(const quantity<U, Rep>& q) noexcept
|
||||
@ -43,4 +43,4 @@ namespace std::experimental::units {
|
||||
return quantity<downcasting_traits_t<unit<dim, r>>, Rep>(std::sqrt(q.count()));
|
||||
}
|
||||
|
||||
} // namespace std::experimental::units
|
||||
} // namespace units
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include <units/bits/concepts.h>
|
||||
#include <limits>
|
||||
|
||||
namespace std::experimental::units {
|
||||
namespace units {
|
||||
|
||||
// is_quantity
|
||||
namespace detail {
|
||||
@ -430,4 +430,4 @@ namespace std::experimental::units {
|
||||
return !(lhs < rhs);
|
||||
}
|
||||
|
||||
} // namespace std::experimental::units
|
||||
} // namespace units
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include <numeric>
|
||||
#include <cstdint>
|
||||
|
||||
namespace std::experimental::units {
|
||||
namespace units {
|
||||
|
||||
namespace detail {
|
||||
|
||||
@ -196,4 +196,4 @@ namespace std::experimental::units {
|
||||
template<Ratio R1, Ratio R2>
|
||||
using common_ratio = detail::common_ratio_impl<R1, R2>::type;
|
||||
|
||||
} // namespace std::experimental::units
|
||||
} // namespace units
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include <units/ratio.h>
|
||||
#include <ratio>
|
||||
|
||||
namespace std::experimental::units {
|
||||
namespace units {
|
||||
|
||||
template<Dimension D, Ratio R = ratio<1>>
|
||||
requires (R::num * R::den > 0)
|
||||
@ -68,7 +68,7 @@ namespace std::experimental::units {
|
||||
|
||||
template<BaseDimension BD, typename... Us>
|
||||
struct get_ratio {
|
||||
using ratio = ::std::experimental::units::ratio<1>;
|
||||
using ratio = ::units::ratio<1>;
|
||||
};
|
||||
|
||||
template<BaseDimension BD, typename U, typename... Rest>
|
||||
@ -99,7 +99,7 @@ namespace std::experimental::units {
|
||||
|
||||
template<typename... Us>
|
||||
struct derived_ratio<dimension<>, Us...> {
|
||||
using ratio = ::std::experimental::units::ratio<1>;
|
||||
using ratio = ::units::ratio<1>;
|
||||
};
|
||||
|
||||
template<typename E, typename... Rest, typename... Us>
|
||||
@ -131,4 +131,4 @@ namespace std::experimental::units {
|
||||
template<Unit U> using peta = unit<typename U::dimension, ratio_multiply<typename U::ratio, ratio<std::peta::num>>>;
|
||||
template<Unit U> using exa = unit<typename U::dimension, ratio_multiply<typename U::ratio, ratio<std::exa::num>>>;
|
||||
|
||||
} // namespace std::experimental::units
|
||||
} // namespace units
|
||||
|
@ -6,8 +6,6 @@ using dim_id = std::integral_constant<int, UniqueValue>;
|
||||
template<typename D1, typename D2>
|
||||
using dim_id_less = std::bool_constant<D1::value < D2::value>;
|
||||
|
||||
namespace stde = std::experimental;
|
||||
|
||||
template<typename... Es>
|
||||
struct dimension;
|
||||
|
||||
@ -21,7 +19,7 @@ using <%= "dim#{i}" %> = dimension<<%=
|
||||
xs.shuffle(random: rng).join(', ')
|
||||
%>>;
|
||||
#if defined(METABENCH)
|
||||
using <%= "result#{i}" %> = stde::units::type_list_sort_t<<%= "dim#{i}" %>, dim_id_less>;
|
||||
using <%= "result#{i}" %> = units::type_list_sort_t<<%= "dim#{i}" %>, dim_id_less>;
|
||||
#else
|
||||
using <%= "result#{i}" %> = void;
|
||||
#endif
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
namespace std::experimental::units {
|
||||
namespace units {
|
||||
|
||||
namespace detail {
|
||||
|
||||
@ -182,4 +182,4 @@ namespace std::experimental::units {
|
||||
template<TypeList List, template<typename, typename> typename Pred>
|
||||
using type_list_sort_t = type_list_sort<List, Pred>::type;
|
||||
|
||||
} // namespace std::experimental::units
|
||||
} // namespace units
|
@ -1,7 +1,5 @@
|
||||
#include "type_list_concepts_iface.h"
|
||||
|
||||
namespace stde = std::experimental;
|
||||
|
||||
template<int UniqueValue>
|
||||
using dim_id = std::integral_constant<int, UniqueValue>;
|
||||
|
||||
@ -22,7 +20,7 @@ using <%= "dim#{i}" %> = dimension<<%=
|
||||
xs.shuffle(random: rng).join(', ')
|
||||
%>>;
|
||||
#if defined(METABENCH)
|
||||
using <%= "result#{i}" %> = stde::units::type_list_sort<<%= "dim#{i}" %>, dim_id_less>;
|
||||
using <%= "result#{i}" %> = units::type_list_sort<<%= "dim#{i}" %>, dim_id_less>;
|
||||
#else
|
||||
using <%= "result#{i}" %> = void;
|
||||
#endif
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
namespace std::experimental::units {
|
||||
namespace units {
|
||||
|
||||
namespace detail {
|
||||
|
||||
@ -201,4 +201,4 @@ namespace std::experimental::units {
|
||||
template<TypeList List, template<typename, typename> typename Pred>
|
||||
using type_list_sort = detail::type_list_sort_impl<List, Pred>::type;
|
||||
|
||||
} // namespace std::experimental::units
|
||||
} // namespace units
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "type_list_concepts_no.h"
|
||||
|
||||
namespace stde = std::experimental;
|
||||
|
||||
template<int UniqueValue>
|
||||
using dim_id = std::integral_constant<int, UniqueValue>;
|
||||
|
||||
@ -22,7 +20,7 @@ using <%= "dim#{i}" %> = dimension<<%=
|
||||
xs.shuffle(random: rng).join(', ')
|
||||
%>>;
|
||||
#if defined(METABENCH)
|
||||
using <%= "result#{i}" %> = stde::units::type_list_sort<<%= "dim#{i}" %>, dim_id_less>;
|
||||
using <%= "result#{i}" %> = units::type_list_sort<<%= "dim#{i}" %>, dim_id_less>;
|
||||
#else
|
||||
using <%= "result#{i}" %> = void;
|
||||
#endif
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
namespace std::experimental::units {
|
||||
namespace units {
|
||||
|
||||
namespace detail {
|
||||
|
||||
@ -188,4 +188,4 @@ namespace std::experimental::units {
|
||||
template<typename List, template<typename, typename> typename Pred>
|
||||
using type_list_sort = detail::type_list_sort_impl<List, Pred>::type;
|
||||
|
||||
} // namespace std::experimental::units
|
||||
} // namespace units
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "type_list_conditional_alias.h"
|
||||
|
||||
namespace stde = std::experimental;
|
||||
|
||||
template<int UniqueValue>
|
||||
using dim_id = std::integral_constant<int, UniqueValue>;
|
||||
|
||||
@ -22,7 +20,7 @@ using <%= "dim#{i}" %> = dimension<<%=
|
||||
xs.shuffle(random: rng).join(', ')
|
||||
%>>;
|
||||
#if defined(METABENCH)
|
||||
using <%= "result#{i}" %> = stde::units::type_list_sort<<%= "dim#{i}" %>, dim_id_less>;
|
||||
using <%= "result#{i}" %> = units::type_list_sort<<%= "dim#{i}" %>, dim_id_less>;
|
||||
#else
|
||||
using <%= "result#{i}" %> = void;
|
||||
#endif
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
namespace std::experimental::units {
|
||||
namespace units {
|
||||
|
||||
namespace detail {
|
||||
|
||||
@ -201,4 +201,4 @@ namespace std::experimental::units {
|
||||
template<TypeList List, template<typename, typename> typename Pred>
|
||||
using type_list_sort = detail::type_list_sort_impl<List, Pred>::type;
|
||||
|
||||
} // namespace std::experimental::units
|
||||
} // namespace units
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "type_list_conditional_alias_hard.h"
|
||||
|
||||
namespace stde = std::experimental;
|
||||
|
||||
template<int UniqueValue>
|
||||
using dim_id = std::integral_constant<int, UniqueValue>;
|
||||
|
||||
@ -22,7 +20,7 @@ using <%= "dim#{i}" %> = dimension<<%=
|
||||
xs.shuffle(random: rng).join(', ')
|
||||
%>>;
|
||||
#if defined(METABENCH)
|
||||
using <%= "result#{i}" %> = stde::units::type_list_sort<<%= "dim#{i}" %>, dim_id_less>;
|
||||
using <%= "result#{i}" %> = units::type_list_sort<<%= "dim#{i}" %>, dim_id_less>;
|
||||
#else
|
||||
using <%= "result#{i}" %> = void;
|
||||
#endif
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
namespace std::experimental::units {
|
||||
namespace units {
|
||||
|
||||
template<bool>
|
||||
struct conditional {
|
||||
@ -194,4 +194,4 @@ namespace std::experimental::units {
|
||||
template<TypeList List, template<typename, typename> typename Pred>
|
||||
using type_list_sort = detail::type_list_sort_impl<List, Pred>::type;
|
||||
|
||||
} // namespace std::experimental::units
|
||||
} // namespace units
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "type_list_conditional_std.h"
|
||||
|
||||
namespace stde = std::experimental;
|
||||
|
||||
template<int UniqueValue>
|
||||
using dim_id = std::integral_constant<int, UniqueValue>;
|
||||
|
||||
@ -22,7 +20,7 @@ using <%= "dim#{i}" %> = dimension<<%=
|
||||
xs.shuffle(random: rng).join(', ')
|
||||
%>>;
|
||||
#if defined(METABENCH)
|
||||
using <%= "result#{i}" %> = stde::units::type_list_sort<<%= "dim#{i}" %>, dim_id_less>;
|
||||
using <%= "result#{i}" %> = units::type_list_sort<<%= "dim#{i}" %>, dim_id_less>;
|
||||
#else
|
||||
using <%= "result#{i}" %> = void;
|
||||
#endif
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
namespace std::experimental::units {
|
||||
namespace units {
|
||||
|
||||
namespace detail {
|
||||
|
||||
@ -182,4 +182,4 @@ namespace std::experimental::units {
|
||||
template<TypeList List, template<typename, typename> typename Pred>
|
||||
using type_list_sort = detail::type_list_sort_impl<List, Pred>::type;
|
||||
|
||||
} // namespace std::experimental::units
|
||||
} // namespace units
|
||||
|
@ -1,16 +1,14 @@
|
||||
#include "dimension_concepts_all.h"
|
||||
|
||||
namespace stde = std::experimental;
|
||||
|
||||
<% (1..100).each do |k| %>
|
||||
struct test<%= k %> {
|
||||
<% (1..n).each do |i| %>
|
||||
static constexpr stde::units::base_dimension dim<%= i %>{"dim<%= i %>"};
|
||||
static constexpr units::base_dimension dim<%= i %>{"dim<%= i %>"};
|
||||
<% end %>
|
||||
|
||||
#if defined(METABENCH)
|
||||
using dim = stde::units::make_dimension_t<<%=
|
||||
xs = ((1)..(n)).map { |j| "stde::units::exp<dim#{j}, 1>" }
|
||||
using dim = units::make_dimension_t<<%=
|
||||
xs = ((1)..(n)).map { |j| "units::exp<dim#{j}, 1>" }
|
||||
rng = Random.new(k)
|
||||
xs.shuffle(random: rng).join(', ')
|
||||
%>>;
|
||||
|
@ -1,16 +1,14 @@
|
||||
#include "dimension_concepts_iface.h"
|
||||
|
||||
namespace stde = std::experimental;
|
||||
|
||||
<% (1..100).each do |k| %>
|
||||
struct test<%= k %> {
|
||||
<% (1..n).each do |i| %>
|
||||
static constexpr stde::units::base_dimension dim<%= i %>{"dim<%= i %>"};
|
||||
static constexpr units::base_dimension dim<%= i %>{"dim<%= i %>"};
|
||||
<% end %>
|
||||
|
||||
#if defined(METABENCH)
|
||||
using dim = stde::units::make_dimension_t<<%=
|
||||
xs = ((1)..(n)).map { |j| "stde::units::exp<dim#{j}, 1>" }
|
||||
using dim = units::make_dimension_t<<%=
|
||||
xs = ((1)..(n)).map { |j| "units::exp<dim#{j}, 1>" }
|
||||
rng = Random.new(k)
|
||||
xs.shuffle(random: rng).join(', ')
|
||||
%>>;
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include "ratio_concepts_all.h"
|
||||
#include <ratio>
|
||||
|
||||
namespace std::experimental::units {
|
||||
namespace units {
|
||||
|
||||
struct base_dimension {
|
||||
const char* name;
|
||||
@ -213,4 +213,4 @@ namespace std::experimental::units {
|
||||
template<Dimension D1, Dimension D2>
|
||||
using dimension_divide_t = dimension_divide<typename D1::base_type, typename D2::base_type>::type;
|
||||
|
||||
} // namespace std::experimental::units
|
||||
} // namespace units
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include "ratio_concepts_iface.h"
|
||||
#include <ratio>
|
||||
|
||||
namespace std::experimental::units {
|
||||
namespace units {
|
||||
|
||||
struct base_dimension {
|
||||
const char* name;
|
||||
@ -213,4 +213,4 @@ namespace std::experimental::units {
|
||||
template<Dimension D1, Dimension D2>
|
||||
using dimension_divide_t = dimension_divide<typename D1::base_type, typename D2::base_type>::type;
|
||||
|
||||
} // namespace std::experimental::units
|
||||
} // namespace units
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include "ratio_no_concepts.h"
|
||||
#include <ratio>
|
||||
|
||||
namespace std::experimental::units {
|
||||
namespace units {
|
||||
|
||||
struct base_dimension {
|
||||
const char* name;
|
||||
@ -184,4 +184,4 @@ namespace std::experimental::units {
|
||||
template<typename D1, typename D2>
|
||||
using dimension_divide_t = dimension_divide<typename D1::base_type, typename D2::base_type>::type;
|
||||
|
||||
} // namespace std::experimental::units
|
||||
} // namespace units
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include "hacks.h"
|
||||
#include <type_traits>
|
||||
|
||||
namespace std::experimental::units {
|
||||
namespace units {
|
||||
|
||||
template<typename BaseType>
|
||||
struct downcast_base {
|
||||
@ -51,4 +51,4 @@ namespace std::experimental::units {
|
||||
template<Downcastable T>
|
||||
using downcasting_traits_t = downcasting_traits<T>::type;
|
||||
|
||||
} // namespace std::experimental::units
|
||||
} // namespace units
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include "hacks.h"
|
||||
#include <type_traits>
|
||||
|
||||
namespace std::experimental::units {
|
||||
namespace units {
|
||||
|
||||
template<typename BaseType>
|
||||
struct downcast_base {
|
||||
@ -44,4 +44,4 @@ namespace std::experimental::units {
|
||||
template<typename T>
|
||||
using downcasting_traits_t = downcasting_traits<T>::type;
|
||||
|
||||
} // namespace std::experimental::units
|
||||
} // namespace units
|
||||
|
@ -1,16 +1,14 @@
|
||||
#include "dimension_no_concepts.h"
|
||||
|
||||
namespace stde = std::experimental;
|
||||
|
||||
<% (1..100).each do |k| %>
|
||||
struct test<%= k %> {
|
||||
<% (1..n).each do |i| %>
|
||||
static constexpr stde::units::base_dimension dim<%= i %>{"dim<%= i %>"};
|
||||
static constexpr units::base_dimension dim<%= i %>{"dim<%= i %>"};
|
||||
<% end %>
|
||||
|
||||
#if defined(METABENCH)
|
||||
using dim = stde::units::make_dimension_t<<%=
|
||||
xs = ((1)..(n)).map { |j| "stde::units::exp<dim#{j}, 1>" }
|
||||
using dim = units::make_dimension_t<<%=
|
||||
xs = ((1)..(n)).map { |j| "units::exp<dim#{j}, 1>" }
|
||||
rng = Random.new(k)
|
||||
xs.shuffle(random: rng).join(', ')
|
||||
%>>;
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include <numeric>
|
||||
#include <cstdint>
|
||||
|
||||
namespace std::experimental::units {
|
||||
namespace units {
|
||||
|
||||
namespace detail {
|
||||
|
||||
@ -135,4 +135,4 @@ namespace std::experimental::units {
|
||||
template<Ratio R1, Ratio R2>
|
||||
using common_ratio = detail::common_ratio_impl<R1, R2>::type;
|
||||
|
||||
} // namespace std::experimental::units
|
||||
} // namespace units
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include <numeric>
|
||||
#include <cstdint>
|
||||
|
||||
namespace std::experimental::units {
|
||||
namespace units {
|
||||
|
||||
namespace detail {
|
||||
|
||||
@ -135,4 +135,4 @@ namespace std::experimental::units {
|
||||
template<Ratio R1, Ratio R2>
|
||||
using common_ratio = detail::common_ratio_impl<R1, R2>::type;
|
||||
|
||||
} // namespace std::experimental::units
|
||||
} // namespace units
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include <numeric>
|
||||
#include <cstdint>
|
||||
|
||||
namespace std::experimental::units {
|
||||
namespace units {
|
||||
|
||||
namespace detail {
|
||||
|
||||
@ -120,4 +120,4 @@ namespace std::experimental::units {
|
||||
template<typename R1, typename R2>
|
||||
using common_ratio = detail::common_ratio_impl<R1, R2>::type;
|
||||
|
||||
} // namespace std::experimental::units
|
||||
} // namespace units
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#include "type_traits.h"
|
||||
|
||||
namespace std::experimental::units {
|
||||
namespace units {
|
||||
|
||||
namespace detail {
|
||||
|
||||
@ -182,4 +182,4 @@ namespace std::experimental::units {
|
||||
template<TypeList List, template<typename, typename> typename Pred>
|
||||
using type_list_sort = detail::type_list_sort_impl<List, Pred>::type;
|
||||
|
||||
} // namespace std::experimental::units
|
||||
} // namespace units
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#include "type_traits.h"
|
||||
|
||||
namespace std::experimental::units {
|
||||
namespace units {
|
||||
|
||||
namespace detail {
|
||||
|
||||
@ -182,4 +182,4 @@ namespace std::experimental::units {
|
||||
template<TypeList List, template<typename, typename> typename Pred>
|
||||
using type_list_sort = detail::type_list_sort_impl<List, Pred>::type;
|
||||
|
||||
} // namespace std::experimental::units
|
||||
} // namespace units
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#include "type_traits.h"
|
||||
|
||||
namespace std::experimental::units {
|
||||
namespace units {
|
||||
|
||||
// push_front
|
||||
|
||||
@ -169,4 +169,4 @@ namespace std::experimental::units {
|
||||
template<typename List, template<typename, typename> typename Pred>
|
||||
using type_list_sort = detail::type_list_sort_impl<List, Pred>::type;
|
||||
|
||||
} // namespace std::experimental::units
|
||||
} // namespace units
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
namespace std::experimental::units {
|
||||
namespace units {
|
||||
|
||||
namespace detail {
|
||||
|
||||
|
@ -1,17 +1,15 @@
|
||||
#include "ratio_type_constexpr.h"
|
||||
|
||||
namespace stde = std::experimental;
|
||||
|
||||
<% (1..n).each do |i| %>
|
||||
struct test<%= i %> {
|
||||
#if defined(METABENCH)
|
||||
using r1 = stde::units::ratio<<%= 2 * i - 1 %>, <%= 2 * n %>>;
|
||||
using r2 = stde::units::ratio<<%= 2 * i %>, <%= 2 * n %>>;
|
||||
using r1 = units::ratio<<%= 2 * i - 1 %>, <%= 2 * n %>>;
|
||||
using r2 = units::ratio<<%= 2 * i %>, <%= 2 * n %>>;
|
||||
|
||||
using r3 = stde::units::ratio_multiply<r1, r2>;
|
||||
using r4 = stde::units::ratio_divide<r1, r2>;
|
||||
using r3 = units::ratio_multiply<r1, r2>;
|
||||
using r4 = units::ratio_divide<r1, r2>;
|
||||
|
||||
using r5 = stde::units::common_ratio_t<r1, r2>;
|
||||
using r5 = units::common_ratio_t<r1, r2>;
|
||||
#else
|
||||
using r1 = void;
|
||||
using r2 = void;
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "std_ratio.h"
|
||||
|
||||
namespace stde = std::experimental;
|
||||
|
||||
<% (1..n).each do |i| %>
|
||||
struct test<%= i %> {
|
||||
#if defined(METABENCH)
|
||||
@ -11,7 +9,7 @@ namespace stde = std::experimental;
|
||||
using r3 = std::ratio_multiply<r1, r2>;
|
||||
using r4 = std::ratio_divide<r1, r2>;
|
||||
|
||||
using r5 = stde::units::common_ratio_t<r1, r2>;
|
||||
using r5 = units::common_ratio_t<r1, r2>;
|
||||
#else
|
||||
using r1 = void;
|
||||
using r2 = void;
|
||||
|
@ -1,14 +1,12 @@
|
||||
#include "ratio_type_constexpr.h"
|
||||
|
||||
namespace stde = std::experimental;
|
||||
|
||||
<% (1..n).each do |i| %>
|
||||
struct test<%= i %> {
|
||||
using r1 = stde::units::ratio<<%= 2 * i - 1 %>, <%= 2 * n %>>;
|
||||
using r2 = stde::units::ratio<<%= 2 * i %>, <%= 2 * n %>>;
|
||||
using r1 = units::ratio<<%= 2 * i - 1 %>, <%= 2 * n %>>;
|
||||
using r2 = units::ratio<<%= 2 * i %>, <%= 2 * n %>>;
|
||||
|
||||
#if defined(METABENCH)
|
||||
using r3 = stde::units::common_ratio_t<r1, r2>;
|
||||
using r3 = units::common_ratio_t<r1, r2>;
|
||||
#else
|
||||
using r3 = void;
|
||||
#endif
|
||||
|
@ -1,14 +1,12 @@
|
||||
#include "std_ratio.h"
|
||||
|
||||
namespace stde = std::experimental;
|
||||
|
||||
<% (1..n).each do |i| %>
|
||||
struct test<%= i %> {
|
||||
using r1 = std::ratio<<%= 2 * i - 1 %>, <%= 2 * n %>>;
|
||||
using r2 = std::ratio<<%= 2 * i %>, <%= 2 * n %>>;
|
||||
|
||||
#if defined(METABENCH)
|
||||
using r3 = stde::units::common_ratio_t<r1, r2>;
|
||||
using r3 = units::common_ratio_t<r1, r2>;
|
||||
#else
|
||||
using r3 = void;
|
||||
#endif
|
||||
|
@ -1,12 +1,10 @@
|
||||
#include "ratio_type_constexpr.h"
|
||||
|
||||
namespace stde = std::experimental;
|
||||
|
||||
<% (1..n).each do |i| %>
|
||||
struct test<%= i %> {
|
||||
#if defined(METABENCH)
|
||||
using r1 = stde::units::ratio<<%= 2 * i - 1 %>, <%= 2 * n %>>;
|
||||
using r2 = stde::units::ratio<<%= 2 * i %>, <%= 2 * n %>>;
|
||||
using r1 = units::ratio<<%= 2 * i - 1 %>, <%= 2 * n %>>;
|
||||
using r2 = units::ratio<<%= 2 * i %>, <%= 2 * n %>>;
|
||||
#else
|
||||
using r1 = void;
|
||||
using r2 = void;
|
||||
|
@ -1,15 +1,13 @@
|
||||
#include "ratio_type_constexpr.h"
|
||||
|
||||
namespace stde = std::experimental;
|
||||
|
||||
<% (1..n).each do |i| %>
|
||||
struct test<%= i %> {
|
||||
using r1 = stde::units::ratio<<%= 2 * i - 1 %>, <%= 2 * n %>>;
|
||||
using r2 = stde::units::ratio<<%= 2 * i %>, <%= 2 * n %>>;
|
||||
using r1 = units::ratio<<%= 2 * i - 1 %>, <%= 2 * n %>>;
|
||||
using r2 = units::ratio<<%= 2 * i %>, <%= 2 * n %>>;
|
||||
|
||||
#if defined(METABENCH)
|
||||
using r3 = stde::units::ratio_multiply<r1, r2>;
|
||||
using r4 = stde::units::ratio_divide<r1, r2>;
|
||||
using r3 = units::ratio_multiply<r1, r2>;
|
||||
using r4 = units::ratio_divide<r1, r2>;
|
||||
#else
|
||||
using r3 = void;
|
||||
using r4 = void;
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
#define Expects(cond) if(!(cond)) ::std::terminate();
|
||||
|
||||
namespace std::experimental::units {
|
||||
namespace units {
|
||||
|
||||
namespace detail {
|
||||
|
||||
@ -122,4 +122,4 @@ namespace std::experimental::units {
|
||||
template<typename R1, typename R2>
|
||||
using common_ratio_t = typename detail::common_ratio_impl<R1, R2>::type;
|
||||
|
||||
} // namespace std::experimental::units
|
||||
} // namespace units
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include <ratio>
|
||||
#include <type_traits>
|
||||
|
||||
namespace std::experimental::units {
|
||||
namespace units {
|
||||
|
||||
// static_sign
|
||||
|
||||
@ -66,4 +66,4 @@ namespace std::experimental::units {
|
||||
template<typename R1, typename R2>
|
||||
using common_ratio_t = typename common_ratio<R1, R2>::type;
|
||||
|
||||
} // namespace std::experimental::units
|
||||
} // namespace units
|
||||
|
@ -28,8 +28,6 @@
|
||||
|
||||
namespace {
|
||||
|
||||
using namespace std::experimental;
|
||||
|
||||
struct base_dim_digital_information { static constexpr const char* value = "digital information"; };
|
||||
|
||||
struct digital_information : units::make_dimension_t<units::exp<base_dim_digital_information, 1>> {};
|
||||
@ -51,11 +49,9 @@ namespace {
|
||||
}
|
||||
}
|
||||
|
||||
namespace stde = std::experimental;
|
||||
|
||||
template<> struct stde::units::downcasting_traits<stde::units::downcast_from<digital_information>> : stde::units::downcast_to<digital_information> {};
|
||||
template<> struct stde::units::downcasting_traits<stde::units::downcast_from<bit>> : stde::units::downcast_to<bit> {};
|
||||
template<> struct stde::units::downcasting_traits<stde::units::downcast_from<::byte>> : stde::units::downcast_to<::byte> {};
|
||||
template<> struct units::downcasting_traits<units::downcast_from<digital_information>> : units::downcast_to<digital_information> {};
|
||||
template<> struct units::downcasting_traits<units::downcast_from<bit>> : units::downcast_to<bit> {};
|
||||
template<> struct units::downcasting_traits<units::downcast_from<::byte>> : units::downcast_to<::byte> {};
|
||||
|
||||
namespace {
|
||||
|
||||
@ -65,7 +61,7 @@ namespace {
|
||||
|
||||
namespace {
|
||||
|
||||
using namespace stde::units;
|
||||
using namespace units;
|
||||
|
||||
// power spectral density
|
||||
struct power_spectral_density : make_dimension_t<units::exp<voltage, 2>, units::exp<frequency, -1>> {};
|
||||
@ -78,7 +74,7 @@ namespace {
|
||||
struct volt_per_sqrt_hertz : unit<amplitude_spectral_density> {};
|
||||
}
|
||||
|
||||
namespace std::experimental::units {
|
||||
namespace units {
|
||||
|
||||
template<> struct downcasting_traits<downcast_from<power_spectral_density>> : downcast_to<power_spectral_density> {};
|
||||
template<> struct downcasting_traits<downcast_from<sq_volt_per_hertz>> : downcast_to<sq_volt_per_hertz> {};
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "units/dimension.h"
|
||||
#include <utility>
|
||||
|
||||
using namespace std::experimental::units;
|
||||
using namespace units;
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include <utility>
|
||||
#include <chrono>
|
||||
|
||||
using namespace std::experimental::units;
|
||||
using namespace units;
|
||||
|
||||
namespace {
|
||||
|
||||
@ -44,7 +44,7 @@ namespace {
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace std::experimental::units {
|
||||
namespace units {
|
||||
|
||||
template<typename T>
|
||||
inline constexpr bool treat_as_floating_point<my_value<T>> = std::is_floating_point_v<T>;
|
||||
@ -56,7 +56,7 @@ namespace std::experimental::units {
|
||||
static constexpr my_value<T> min() { return std::numeric_limits<T>::lowest(); }
|
||||
};
|
||||
|
||||
} // namespace std::experimental::units
|
||||
} // namespace units
|
||||
|
||||
namespace std {
|
||||
|
||||
@ -72,7 +72,7 @@ namespace std {
|
||||
|
||||
namespace {
|
||||
|
||||
using namespace std::experimental::units;
|
||||
using namespace units;
|
||||
|
||||
// class invariants
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
namespace {
|
||||
|
||||
using namespace std::experimental::units;
|
||||
using namespace units;
|
||||
|
||||
template<Ratio R1, Ratio R2>
|
||||
inline constexpr bool same = R1::num == R2::num && R1::den == R2::den;
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
namespace {
|
||||
|
||||
using namespace std::experimental::units;
|
||||
using namespace units;
|
||||
|
||||
template<typename... Types>
|
||||
struct type_list;
|
||||
|
@ -46,7 +46,7 @@
|
||||
|
||||
namespace {
|
||||
|
||||
using namespace std::experimental::units;
|
||||
using namespace units;
|
||||
|
||||
/* ************** BASE DIMENSIONS **************** */
|
||||
|
||||
|
@ -23,11 +23,10 @@
|
||||
#include <units/dimensions/velocity.h>
|
||||
#include <iostream>
|
||||
|
||||
namespace stde = std::experimental;
|
||||
using namespace stde::units::literals;
|
||||
using namespace units::literals;
|
||||
|
||||
template<stde::units::Length D, stde::units::Time T>
|
||||
constexpr stde::units::Velocity avg_speed(D d, T t)
|
||||
template<units::Length D, units::Time T>
|
||||
constexpr units::Velocity avg_speed(D d, T t)
|
||||
{
|
||||
return d / t;
|
||||
}
|
||||
|
Reference in New Issue
Block a user