units removed from a std::experimental namespace

This commit is contained in:
Mateusz Pusz
2019-09-18 21:55:16 -06:00
parent 6390eba786
commit c3d7359ca3
74 changed files with 164 additions and 200 deletions

View File

@@ -57,7 +57,7 @@ NOTE: This library as of now compiles correctly only with gcc-9.1 and newer.
## Release notes ## Release notes
- 0.4.0 ??? - 0.4.0 ???
- - `units` removed from a `std::experimental` namespace
- 0.3.1 Sep 18, 2019 - 0.3.1 Sep 18, 2019
- cmcstl2 dependency changed to range-v3 0.9.1 - cmcstl2 dependency changed to range-v3 0.9.1

View File

@@ -51,7 +51,7 @@ Quantity is a concrete amount of a unit for a specified dimension with a specifi
```cpp ```cpp
units::quantity<units::kilometre, double> d1(123); 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: 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; const Velocity auto t = 20s;
^~~~ ^~~~
In file included from <path>\example\example.cpp:23: 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>; concept Velocity = Quantity<T> && std::same_as<typename T::dimension, velocity>;
^~~~~~~~ ^~~~~~~~
In file included from <path>/src/include/units/bits/tools.h:25, 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/base_dimensions.h:25,
from <path>/src/include/units/si/velocity.h:25, from <path>/src/include/units/si/velocity.h:25,
from <path>\example\example.cpp:23: 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>; 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 <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 out there, but even for those dimensions
```text ```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 and
```text ```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. 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; const Velocity t = 20s;
^~~~ ^~~~
In file included from <path>\example\example.cpp:23: 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>; concept Velocity = Quantity<T> && std::same_as<typename T::dimension, velocity>;
^~~~~~~~ ^~~~~~~~
In file included from <path>/src/include/units/bits/tools.h:25, 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/base_dimensions.h:25,
from <path>/src/include/units/si/velocity.h:25, from <path>/src/include/units/si/velocity.h:25,
from <path>\example\example.cpp:23: 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>; 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 <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 Now
```text ```text
[with T = stde::units::quantity<units::second, long long int>] [with T = units::quantity<units::second, long long int>]
``` ```
and and
```text ```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. are not arguably much easier to understand thus provide better user experience.

View File

@@ -25,28 +25,27 @@
namespace { namespace {
namespace stde = std::experimental; using namespace units::literals;
using namespace stde::units::literals;
template<stde::units::Length D, stde::units::Time T> template<units::Length D, units::Time T>
constexpr stde::units::Velocity avg_speed(D d, T t) constexpr units::Velocity avg_speed(D d, T t)
{ {
return d / 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) 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 " 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) void example_2(double distance_v, double duration_v)
{ {
stde::units::quantity<stde::units::kilometre> distance(distance_v); units::quantity<units::kilometre> distance(distance_v);
stde::units::quantity<stde::units::hour> duration(duration_v); units::quantity<units::hour> duration(duration_v);
const auto kmph = quantity_cast<stde::units::kilometre_per_hour>(avg_speed(distance, duration)); 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 " std::cout << "Average speed of a car that makes " << distance.count() << " km in "
<< duration.count() << " hours is " << kmph.count() << " km/h.\n"; << duration.count() << " hours is " << kmph.count() << " km/h.\n";
} }

View File

@@ -24,7 +24,7 @@
#include <units/bits/hacks.h> #include <units/bits/hacks.h>
namespace std::experimental::units { namespace units {
template<typename T> template<typename T>
concept bool Number = std::regular<T> && concept bool Number = std::regular<T> &&
@@ -43,4 +43,4 @@ namespace std::experimental::units {
// … // …
}; };
} // namespace std::experimental::units } // namespace units

View File

@@ -25,7 +25,7 @@
#include <units/bits/hacks.h> #include <units/bits/hacks.h>
#include <type_traits> #include <type_traits>
namespace std::experimental::units { namespace units {
template<typename BaseType> template<typename BaseType>
struct downcast_base { struct downcast_base {
@@ -51,4 +51,4 @@ namespace std::experimental::units {
template<Downcastable T> template<Downcastable T>
using downcasting_traits_t = downcasting_traits<T>::type; using downcasting_traits_t = downcasting_traits<T>::type;
} // namespace std::experimental::units } // namespace units

View File

@@ -24,7 +24,7 @@
#include <units/bits/type_traits.h> #include <units/bits/type_traits.h>
namespace std::experimental::units { namespace units {
namespace detail { namespace detail {
@@ -182,4 +182,4 @@ namespace std::experimental::units {
template<TypeList List, template<typename, typename> typename Pred> template<TypeList List, template<typename, typename> typename Pred>
using type_list_sort = detail::type_list_sort_impl<List, Pred>::type; using type_list_sort = detail::type_list_sort_impl<List, Pred>::type;
} // namespace std::experimental::units } // namespace units

View File

@@ -24,7 +24,7 @@
#include <type_traits> #include <type_traits>
namespace std::experimental::units { namespace units {
namespace detail { namespace detail {

View File

@@ -27,7 +27,7 @@
#include <units/ratio.h> #include <units/ratio.h>
#include <ratio> #include <ratio>
namespace std::experimental::units { namespace units {
template<typename T> template<typename T>
concept bool BaseDimension = std::is_empty_v<T> && concept bool BaseDimension = std::is_empty_v<T> &&
@@ -286,4 +286,4 @@ namespace std::experimental::units {
template<Dimension D, std::size_t N> template<Dimension D, std::size_t N>
using dimension_pow_t = dimension_pow<typename D::base_type, N>::type; using dimension_pow_t = dimension_pow<typename D::base_type, N>::type;
} // namespace std::experimental::units } // namespace units

View File

@@ -24,7 +24,7 @@
#include <units/dimensions/velocity.h> #include <units/dimensions/velocity.h>
namespace std::experimental::units { namespace units {
struct acceleration : make_dimension_t<exp<velocity, 1>, exp<base_dim_time, -1>> {}; struct acceleration : make_dimension_t<exp<velocity, 1>, exp<base_dim_time, -1>> {};
template<> struct downcasting_traits<downcast_from<acceleration>> : downcast_to<acceleration> {}; template<> struct downcasting_traits<downcast_from<acceleration>> : downcast_to<acceleration> {};
@@ -43,4 +43,4 @@ namespace std::experimental::units {
} // namespace literals } // namespace literals
} // namespace std::experimental::units } // namespace units

View File

@@ -24,7 +24,7 @@
#include <units/dimensions/length.h> #include <units/dimensions/length.h>
namespace std::experimental::units { namespace units {
struct area : make_dimension_t<exp<base_dim_length, 2>> {}; struct area : make_dimension_t<exp<base_dim_length, 2>> {};
template<> struct downcasting_traits<downcast_from<area>> : downcast_to<area> {}; template<> struct downcasting_traits<downcast_from<area>> : downcast_to<area> {};
@@ -67,4 +67,4 @@ namespace std::experimental::units {
} // namespace literals } // namespace literals
} // namespace std::experimental::units } // namespace units

View File

@@ -24,7 +24,7 @@
#include <units/dimension.h> #include <units/dimension.h>
namespace std::experimental::units { namespace units {
struct base_dim_length { static constexpr const char* value = "length"; }; struct base_dim_length { static constexpr const char* value = "length"; };
struct base_dim_mass { static constexpr const char* value = "mass"; }; 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_substance { static constexpr const char* value = "substance"; };
struct base_dim_luminous_intensity { static constexpr const char* value = "luminous intensity"; }; struct base_dim_luminous_intensity { static constexpr const char* value = "luminous intensity"; };
} // namespace std::experimental::units } // namespace units

View File

@@ -26,7 +26,7 @@
#include <units/dimensions/electric_charge.h> #include <units/dimensions/electric_charge.h>
#include <units/dimensions/voltage.h> #include <units/dimensions/voltage.h>
namespace std::experimental::units { namespace units {
struct capacitance : make_dimension_t<exp<electric_charge, 1>, exp<voltage, -1>> {}; struct capacitance : make_dimension_t<exp<electric_charge, 1>, exp<voltage, -1>> {};
template<> struct downcasting_traits<downcast_from<capacitance>> : downcast_to<capacitance> {}; template<> struct downcasting_traits<downcast_from<capacitance>> : downcast_to<capacitance> {};
@@ -45,4 +45,4 @@ namespace std::experimental::units {
} // namespace literals } // namespace literals
} // namespace std::experimental::units } // namespace units

View File

@@ -25,7 +25,7 @@
#include <units/dimensions/base_dimensions.h> #include <units/dimensions/base_dimensions.h>
#include <units/quantity.h> #include <units/quantity.h>
namespace std::experimental::units { namespace units {
struct current : make_dimension_t<exp<base_dim_current, 1>> {}; struct current : make_dimension_t<exp<base_dim_current, 1>> {};
template<> struct downcasting_traits<downcast_from<current>> : downcast_to<current> {}; template<> struct downcasting_traits<downcast_from<current>> : downcast_to<current> {};
@@ -44,4 +44,4 @@ namespace std::experimental::units {
} }
} // namespace std::experimental::units } // namespace units

View File

@@ -26,7 +26,7 @@
#include <units/dimensions/time.h> #include <units/dimensions/time.h>
#include <units/dimensions/current.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>> {}; 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<> struct downcasting_traits<downcast_from<electric_charge>> : downcast_to<electric_charge> {};
@@ -45,4 +45,4 @@ namespace std::experimental::units {
} // namespace literals } // namespace literals
} // namespace std::experimental::units } // namespace units

View File

@@ -26,7 +26,7 @@
#include <units/dimensions/force.h> #include <units/dimensions/force.h>
#include <units/dimensions/pressure.h> #include <units/dimensions/pressure.h>
namespace std::experimental::units { namespace units {
struct energy : make_dimension_t<exp<force, 1>, exp<length, 1>> {}; struct energy : make_dimension_t<exp<force, 1>, exp<length, 1>> {};
template<> struct downcasting_traits<downcast_from<energy>> : downcast_to<energy> {}; template<> struct downcasting_traits<downcast_from<energy>> : downcast_to<energy> {};
@@ -45,4 +45,4 @@ namespace std::experimental::units {
} // namespace literals } // namespace literals
} // namespace std::experimental::units } // namespace units

View File

@@ -26,7 +26,7 @@
#include <units/dimensions/mass.h> #include <units/dimensions/mass.h>
#include <units/dimensions/acceleration.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>> {}; struct force : make_dimension_t<exp<base_dim_mass, 1>, exp<acceleration, 1>> {};
template<> struct downcasting_traits<downcast_from<force>> : downcast_to<force> {}; template<> struct downcasting_traits<downcast_from<force>> : downcast_to<force> {};
@@ -45,4 +45,4 @@ namespace std::experimental::units {
} // namespace literals } // namespace literals
} // namespace std::experimental::units } // namespace units

View File

@@ -25,7 +25,7 @@
#include <units/dimensions/base_dimensions.h> #include <units/dimensions/base_dimensions.h>
#include <units/dimensions/time.h> #include <units/dimensions/time.h>
namespace std::experimental::units { namespace units {
struct frequency : make_dimension_t<exp<base_dim_time, -1>> {}; struct frequency : make_dimension_t<exp<base_dim_time, -1>> {};
template<> struct downcasting_traits<downcast_from<frequency>> : downcast_to<frequency> {}; template<> struct downcasting_traits<downcast_from<frequency>> : downcast_to<frequency> {};
@@ -79,4 +79,4 @@ namespace std::experimental::units {
} // namespace literals } // namespace literals
} // namespace std::experimental::units } // namespace units

View File

@@ -25,7 +25,7 @@
#include <units/dimensions/base_dimensions.h> #include <units/dimensions/base_dimensions.h>
#include <units/quantity.h> #include <units/quantity.h>
namespace std::experimental::units { namespace units {
struct length : make_dimension_t<exp<base_dim_length, 1>> {}; struct length : make_dimension_t<exp<base_dim_length, 1>> {};
template<> struct downcasting_traits<downcast_from<length>> : downcast_to<length> {}; template<> struct downcasting_traits<downcast_from<length>> : downcast_to<length> {};
@@ -99,4 +99,4 @@ namespace std::experimental::units {
} // namespace literals } // namespace literals
} // namespace std::experimental::units } // namespace units

View File

@@ -25,7 +25,7 @@
#include <units/dimensions/base_dimensions.h> #include <units/dimensions/base_dimensions.h>
#include <units/quantity.h> #include <units/quantity.h>
namespace std::experimental::units { namespace units {
struct luminous_intensity : make_dimension_t<exp<base_dim_luminous_intensity, 1>> {}; 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<> struct downcasting_traits<downcast_from<luminous_intensity>> : downcast_to<luminous_intensity> {};
@@ -44,4 +44,4 @@ namespace std::experimental::units {
} // namespace literals } // namespace literals
} // namespace std::experimental::units } // namespace units

View File

@@ -25,7 +25,7 @@
#include <units/dimensions/base_dimensions.h> #include <units/dimensions/base_dimensions.h>
#include <units/quantity.h> #include <units/quantity.h>
namespace std::experimental::units { namespace units {
struct mass : make_dimension_t<exp<base_dim_mass, 1>> {}; struct mass : make_dimension_t<exp<base_dim_mass, 1>> {};
template<> struct downcasting_traits<downcast_from<mass>> : downcast_to<mass> {}; template<> struct downcasting_traits<downcast_from<mass>> : downcast_to<mass> {};
@@ -51,4 +51,4 @@ namespace std::experimental::units {
} // namespace literals } // namespace literals
} // namespace std::experimental::units } // namespace units

View File

@@ -25,7 +25,7 @@
#include <units/dimensions/base_dimensions.h> #include <units/dimensions/base_dimensions.h>
#include <units/dimensions/energy.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>> {}; struct power : make_dimension_t<exp<energy, 1>, exp<base_dim_time, -1>> {};
template<> struct downcasting_traits<downcast_from<power>> : downcast_to<power> {}; template<> struct downcasting_traits<downcast_from<power>> : downcast_to<power> {};
@@ -44,4 +44,4 @@ namespace std::experimental::units {
} // namespace literals } // namespace literals
} // namespace std::experimental::units } // namespace units

View File

@@ -26,7 +26,7 @@
#include <units/dimensions/force.h> #include <units/dimensions/force.h>
#include <units/dimensions/area.h> #include <units/dimensions/area.h>
namespace std::experimental::units { namespace units {
struct pressure : make_dimension_t<exp<force, 1>, exp<area, -1>> {}; struct pressure : make_dimension_t<exp<force, 1>, exp<area, -1>> {};
template<> struct downcasting_traits<downcast_from<pressure>> : downcast_to<pressure> {}; template<> struct downcasting_traits<downcast_from<pressure>> : downcast_to<pressure> {};
@@ -45,4 +45,4 @@ namespace std::experimental::units {
} // namespace literals } // namespace literals
} // namespace std::experimental::units } // namespace units

View File

@@ -25,7 +25,7 @@
#include <units/dimensions/base_dimensions.h> #include <units/dimensions/base_dimensions.h>
#include <units/quantity.h> #include <units/quantity.h>
namespace std::experimental::units { namespace units {
struct substance : make_dimension_t<exp<base_dim_substance, 1>> {}; struct substance : make_dimension_t<exp<base_dim_substance, 1>> {};
template<> struct downcasting_traits<downcast_from<substance>> : downcast_to<substance> {}; template<> struct downcasting_traits<downcast_from<substance>> : downcast_to<substance> {};
@@ -44,4 +44,4 @@ namespace std::experimental::units {
} // namespace literals } // namespace literals
} // namespace std::experimental::units } // namespace units

View File

@@ -25,7 +25,7 @@
#include <units/dimensions/base_dimensions.h> #include <units/dimensions/base_dimensions.h>
#include <units/quantity.h> #include <units/quantity.h>
namespace std::experimental::units { namespace units {
struct temperature : make_dimension_t<exp<base_dim_temperature, 1>> {}; struct temperature : make_dimension_t<exp<base_dim_temperature, 1>> {};
template<> struct downcasting_traits<downcast_from<temperature>> : downcast_to<temperature> {}; template<> struct downcasting_traits<downcast_from<temperature>> : downcast_to<temperature> {};
@@ -44,4 +44,4 @@ namespace std::experimental::units {
} // namespace literals } // namespace literals
} // namespace std::experimental::units } // namespace units

View File

@@ -25,7 +25,7 @@
#include <units/dimensions/base_dimensions.h> #include <units/dimensions/base_dimensions.h>
#include <units/quantity.h> #include <units/quantity.h>
namespace std::experimental::units { namespace units {
struct time : make_dimension_t<exp<base_dim_time, 1>> {}; struct time : make_dimension_t<exp<base_dim_time, 1>> {};
template<> struct downcasting_traits<downcast_from<time>> : downcast_to<time> {}; template<> struct downcasting_traits<downcast_from<time>> : downcast_to<time> {};
@@ -79,4 +79,4 @@ namespace std::experimental::units {
} // namespace literals } // namespace literals
} // namespace std::experimental::units } // namespace units

View File

@@ -25,7 +25,7 @@
#include <units/dimensions/length.h> #include <units/dimensions/length.h>
#include <units/dimensions/time.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>> {}; 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<> struct downcasting_traits<downcast_from<velocity>> : downcast_to<velocity> {};
@@ -58,4 +58,4 @@ namespace std::experimental::units {
} // namespace literals } // namespace literals
} // namespace std::experimental::units } // namespace units

View File

@@ -28,7 +28,7 @@
#include <units/dimensions/energy.h> #include <units/dimensions/energy.h>
#include <units/dimensions/electric_charge.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>> {}; struct voltage : make_dimension_t<exp<power, 1>, exp<base_dim_current, -1>> {};
template<> struct downcasting_traits<downcast_from<voltage>> : downcast_to<voltage> {}; template<> struct downcasting_traits<downcast_from<voltage>> : downcast_to<voltage> {};
@@ -47,4 +47,4 @@ namespace std::experimental::units {
} // namespace literals } // namespace literals
} // namespace std::experimental::units } // namespace units

View File

@@ -24,7 +24,7 @@
#include <units/dimensions/length.h> #include <units/dimensions/length.h>
namespace std::experimental::units { namespace units {
struct volume : make_dimension_t<exp<base_dim_length, 3>> {}; struct volume : make_dimension_t<exp<base_dim_length, 3>> {};
template<> struct downcasting_traits<downcast_from<volume>> : downcast_to<volume> {}; template<> struct downcasting_traits<downcast_from<volume>> : downcast_to<volume> {};
@@ -67,4 +67,4 @@ namespace std::experimental::units {
} // namespace literals } // namespace literals
} // namespace std::experimental::units } // namespace units

View File

@@ -25,7 +25,7 @@
#include <units/quantity.h> #include <units/quantity.h>
#include <cmath> #include <cmath>
namespace std::experimental::units { namespace units {
template<std::size_t N, typename U, typename Rep> template<std::size_t N, typename U, typename Rep>
inline Quantity pow(const quantity<U, Rep>& q) noexcept 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())); return quantity<downcasting_traits_t<unit<dim, r>>, Rep>(std::sqrt(q.count()));
} }
} // namespace std::experimental::units } // namespace units

View File

@@ -26,7 +26,7 @@
#include <units/bits/concepts.h> #include <units/bits/concepts.h>
#include <limits> #include <limits>
namespace std::experimental::units { namespace units {
// is_quantity // is_quantity
namespace detail { namespace detail {
@@ -430,4 +430,4 @@ namespace std::experimental::units {
return !(lhs < rhs); return !(lhs < rhs);
} }
} // namespace std::experimental::units } // namespace units

View File

@@ -27,7 +27,7 @@
#include <numeric> #include <numeric>
#include <cstdint> #include <cstdint>
namespace std::experimental::units { namespace units {
namespace detail { namespace detail {
@@ -196,4 +196,4 @@ namespace std::experimental::units {
template<Ratio R1, Ratio R2> template<Ratio R1, Ratio R2>
using common_ratio = detail::common_ratio_impl<R1, R2>::type; using common_ratio = detail::common_ratio_impl<R1, R2>::type;
} // namespace std::experimental::units } // namespace units

View File

@@ -26,7 +26,7 @@
#include <units/ratio.h> #include <units/ratio.h>
#include <ratio> #include <ratio>
namespace std::experimental::units { namespace units {
template<Dimension D, Ratio R = ratio<1>> template<Dimension D, Ratio R = ratio<1>>
requires (R::num * R::den > 0) requires (R::num * R::den > 0)
@@ -68,7 +68,7 @@ namespace std::experimental::units {
template<BaseDimension BD, typename... Us> template<BaseDimension BD, typename... Us>
struct get_ratio { struct get_ratio {
using ratio = ::std::experimental::units::ratio<1>; using ratio = ::units::ratio<1>;
}; };
template<BaseDimension BD, typename U, typename... Rest> template<BaseDimension BD, typename U, typename... Rest>
@@ -99,7 +99,7 @@ namespace std::experimental::units {
template<typename... Us> template<typename... Us>
struct derived_ratio<dimension<>, 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> 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 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>>>; template<Unit U> using exa = unit<typename U::dimension, ratio_multiply<typename U::ratio, ratio<std::exa::num>>>;
} // namespace std::experimental::units } // namespace units

View File

@@ -6,8 +6,6 @@ using dim_id = std::integral_constant<int, UniqueValue>;
template<typename D1, typename D2> template<typename D1, typename D2>
using dim_id_less = std::bool_constant<D1::value < D2::value>; using dim_id_less = std::bool_constant<D1::value < D2::value>;
namespace stde = std::experimental;
template<typename... Es> template<typename... Es>
struct dimension; struct dimension;
@@ -21,7 +19,7 @@ using <%= "dim#{i}" %> = dimension<<%=
xs.shuffle(random: rng).join(', ') xs.shuffle(random: rng).join(', ')
%>>; %>>;
#if defined(METABENCH) #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 #else
using <%= "result#{i}" %> = void; using <%= "result#{i}" %> = void;
#endif #endif

View File

@@ -24,7 +24,7 @@
#include <type_traits> #include <type_traits>
namespace std::experimental::units { namespace units {
namespace detail { namespace detail {
@@ -182,4 +182,4 @@ namespace std::experimental::units {
template<TypeList List, template<typename, typename> typename Pred> template<TypeList List, template<typename, typename> typename Pred>
using type_list_sort_t = type_list_sort<List, Pred>::type; using type_list_sort_t = type_list_sort<List, Pred>::type;
} // namespace std::experimental::units } // namespace units

View File

@@ -1,7 +1,5 @@
#include "type_list_concepts_iface.h" #include "type_list_concepts_iface.h"
namespace stde = std::experimental;
template<int UniqueValue> template<int UniqueValue>
using dim_id = std::integral_constant<int, UniqueValue>; using dim_id = std::integral_constant<int, UniqueValue>;
@@ -22,7 +20,7 @@ using <%= "dim#{i}" %> = dimension<<%=
xs.shuffle(random: rng).join(', ') xs.shuffle(random: rng).join(', ')
%>>; %>>;
#if defined(METABENCH) #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 #else
using <%= "result#{i}" %> = void; using <%= "result#{i}" %> = void;
#endif #endif

View File

@@ -24,7 +24,7 @@
#include <type_traits> #include <type_traits>
namespace std::experimental::units { namespace units {
namespace detail { namespace detail {
@@ -201,4 +201,4 @@ namespace std::experimental::units {
template<TypeList List, template<typename, typename> typename Pred> template<TypeList List, template<typename, typename> typename Pred>
using type_list_sort = detail::type_list_sort_impl<List, Pred>::type; using type_list_sort = detail::type_list_sort_impl<List, Pred>::type;
} // namespace std::experimental::units } // namespace units

View File

@@ -1,7 +1,5 @@
#include "type_list_concepts_no.h" #include "type_list_concepts_no.h"
namespace stde = std::experimental;
template<int UniqueValue> template<int UniqueValue>
using dim_id = std::integral_constant<int, UniqueValue>; using dim_id = std::integral_constant<int, UniqueValue>;
@@ -22,7 +20,7 @@ using <%= "dim#{i}" %> = dimension<<%=
xs.shuffle(random: rng).join(', ') xs.shuffle(random: rng).join(', ')
%>>; %>>;
#if defined(METABENCH) #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 #else
using <%= "result#{i}" %> = void; using <%= "result#{i}" %> = void;
#endif #endif

View File

@@ -24,7 +24,7 @@
#include <type_traits> #include <type_traits>
namespace std::experimental::units { namespace units {
namespace detail { namespace detail {
@@ -188,4 +188,4 @@ namespace std::experimental::units {
template<typename List, template<typename, typename> typename Pred> template<typename List, template<typename, typename> typename Pred>
using type_list_sort = detail::type_list_sort_impl<List, Pred>::type; using type_list_sort = detail::type_list_sort_impl<List, Pred>::type;
} // namespace std::experimental::units } // namespace units

View File

@@ -1,7 +1,5 @@
#include "type_list_conditional_alias.h" #include "type_list_conditional_alias.h"
namespace stde = std::experimental;
template<int UniqueValue> template<int UniqueValue>
using dim_id = std::integral_constant<int, UniqueValue>; using dim_id = std::integral_constant<int, UniqueValue>;
@@ -22,7 +20,7 @@ using <%= "dim#{i}" %> = dimension<<%=
xs.shuffle(random: rng).join(', ') xs.shuffle(random: rng).join(', ')
%>>; %>>;
#if defined(METABENCH) #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 #else
using <%= "result#{i}" %> = void; using <%= "result#{i}" %> = void;
#endif #endif

View File

@@ -24,7 +24,7 @@
#include <type_traits> #include <type_traits>
namespace std::experimental::units { namespace units {
namespace detail { namespace detail {
@@ -201,4 +201,4 @@ namespace std::experimental::units {
template<TypeList List, template<typename, typename> typename Pred> template<TypeList List, template<typename, typename> typename Pred>
using type_list_sort = detail::type_list_sort_impl<List, Pred>::type; using type_list_sort = detail::type_list_sort_impl<List, Pred>::type;
} // namespace std::experimental::units } // namespace units

View File

@@ -1,7 +1,5 @@
#include "type_list_conditional_alias_hard.h" #include "type_list_conditional_alias_hard.h"
namespace stde = std::experimental;
template<int UniqueValue> template<int UniqueValue>
using dim_id = std::integral_constant<int, UniqueValue>; using dim_id = std::integral_constant<int, UniqueValue>;
@@ -22,7 +20,7 @@ using <%= "dim#{i}" %> = dimension<<%=
xs.shuffle(random: rng).join(', ') xs.shuffle(random: rng).join(', ')
%>>; %>>;
#if defined(METABENCH) #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 #else
using <%= "result#{i}" %> = void; using <%= "result#{i}" %> = void;
#endif #endif

View File

@@ -24,7 +24,7 @@
#include <type_traits> #include <type_traits>
namespace std::experimental::units { namespace units {
template<bool> template<bool>
struct conditional { struct conditional {
@@ -194,4 +194,4 @@ namespace std::experimental::units {
template<TypeList List, template<typename, typename> typename Pred> template<TypeList List, template<typename, typename> typename Pred>
using type_list_sort = detail::type_list_sort_impl<List, Pred>::type; using type_list_sort = detail::type_list_sort_impl<List, Pred>::type;
} // namespace std::experimental::units } // namespace units

View File

@@ -1,7 +1,5 @@
#include "type_list_conditional_std.h" #include "type_list_conditional_std.h"
namespace stde = std::experimental;
template<int UniqueValue> template<int UniqueValue>
using dim_id = std::integral_constant<int, UniqueValue>; using dim_id = std::integral_constant<int, UniqueValue>;
@@ -22,7 +20,7 @@ using <%= "dim#{i}" %> = dimension<<%=
xs.shuffle(random: rng).join(', ') xs.shuffle(random: rng).join(', ')
%>>; %>>;
#if defined(METABENCH) #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 #else
using <%= "result#{i}" %> = void; using <%= "result#{i}" %> = void;
#endif #endif

View File

@@ -24,7 +24,7 @@
#include <type_traits> #include <type_traits>
namespace std::experimental::units { namespace units {
namespace detail { namespace detail {
@@ -182,4 +182,4 @@ namespace std::experimental::units {
template<TypeList List, template<typename, typename> typename Pred> template<TypeList List, template<typename, typename> typename Pred>
using type_list_sort = detail::type_list_sort_impl<List, Pred>::type; using type_list_sort = detail::type_list_sort_impl<List, Pred>::type;
} // namespace std::experimental::units } // namespace units

View File

@@ -1,16 +1,14 @@
#include "dimension_concepts_all.h" #include "dimension_concepts_all.h"
namespace stde = std::experimental;
<% (1..100).each do |k| %> <% (1..100).each do |k| %>
struct test<%= k %> { struct test<%= k %> {
<% (1..n).each do |i| %> <% (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 %> <% end %>
#if defined(METABENCH) #if defined(METABENCH)
using dim = stde::units::make_dimension_t<<%= using dim = units::make_dimension_t<<%=
xs = ((1)..(n)).map { |j| "stde::units::exp<dim#{j}, 1>" } xs = ((1)..(n)).map { |j| "units::exp<dim#{j}, 1>" }
rng = Random.new(k) rng = Random.new(k)
xs.shuffle(random: rng).join(', ') xs.shuffle(random: rng).join(', ')
%>>; %>>;

View File

@@ -1,16 +1,14 @@
#include "dimension_concepts_iface.h" #include "dimension_concepts_iface.h"
namespace stde = std::experimental;
<% (1..100).each do |k| %> <% (1..100).each do |k| %>
struct test<%= k %> { struct test<%= k %> {
<% (1..n).each do |i| %> <% (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 %> <% end %>
#if defined(METABENCH) #if defined(METABENCH)
using dim = stde::units::make_dimension_t<<%= using dim = units::make_dimension_t<<%=
xs = ((1)..(n)).map { |j| "stde::units::exp<dim#{j}, 1>" } xs = ((1)..(n)).map { |j| "units::exp<dim#{j}, 1>" }
rng = Random.new(k) rng = Random.new(k)
xs.shuffle(random: rng).join(', ') xs.shuffle(random: rng).join(', ')
%>>; %>>;

View File

@@ -27,7 +27,7 @@
#include "ratio_concepts_all.h" #include "ratio_concepts_all.h"
#include <ratio> #include <ratio>
namespace std::experimental::units { namespace units {
struct base_dimension { struct base_dimension {
const char* name; const char* name;
@@ -213,4 +213,4 @@ namespace std::experimental::units {
template<Dimension D1, Dimension D2> template<Dimension D1, Dimension D2>
using dimension_divide_t = dimension_divide<typename D1::base_type, typename D2::base_type>::type; using dimension_divide_t = dimension_divide<typename D1::base_type, typename D2::base_type>::type;
} // namespace std::experimental::units } // namespace units

View File

@@ -27,7 +27,7 @@
#include "ratio_concepts_iface.h" #include "ratio_concepts_iface.h"
#include <ratio> #include <ratio>
namespace std::experimental::units { namespace units {
struct base_dimension { struct base_dimension {
const char* name; const char* name;
@@ -213,4 +213,4 @@ namespace std::experimental::units {
template<Dimension D1, Dimension D2> template<Dimension D1, Dimension D2>
using dimension_divide_t = dimension_divide<typename D1::base_type, typename D2::base_type>::type; using dimension_divide_t = dimension_divide<typename D1::base_type, typename D2::base_type>::type;
} // namespace std::experimental::units } // namespace units

View File

@@ -27,7 +27,7 @@
#include "ratio_no_concepts.h" #include "ratio_no_concepts.h"
#include <ratio> #include <ratio>
namespace std::experimental::units { namespace units {
struct base_dimension { struct base_dimension {
const char* name; const char* name;
@@ -184,4 +184,4 @@ namespace std::experimental::units {
template<typename D1, typename D2> template<typename D1, typename D2>
using dimension_divide_t = dimension_divide<typename D1::base_type, typename D2::base_type>::type; using dimension_divide_t = dimension_divide<typename D1::base_type, typename D2::base_type>::type;
} // namespace std::experimental::units } // namespace units

View File

@@ -25,7 +25,7 @@
#include "hacks.h" #include "hacks.h"
#include <type_traits> #include <type_traits>
namespace std::experimental::units { namespace units {
template<typename BaseType> template<typename BaseType>
struct downcast_base { struct downcast_base {
@@ -51,4 +51,4 @@ namespace std::experimental::units {
template<Downcastable T> template<Downcastable T>
using downcasting_traits_t = downcasting_traits<T>::type; using downcasting_traits_t = downcasting_traits<T>::type;
} // namespace std::experimental::units } // namespace units

View File

@@ -25,7 +25,7 @@
#include "hacks.h" #include "hacks.h"
#include <type_traits> #include <type_traits>
namespace std::experimental::units { namespace units {
template<typename BaseType> template<typename BaseType>
struct downcast_base { struct downcast_base {
@@ -44,4 +44,4 @@ namespace std::experimental::units {
template<typename T> template<typename T>
using downcasting_traits_t = downcasting_traits<T>::type; using downcasting_traits_t = downcasting_traits<T>::type;
} // namespace std::experimental::units } // namespace units

View File

@@ -1,16 +1,14 @@
#include "dimension_no_concepts.h" #include "dimension_no_concepts.h"
namespace stde = std::experimental;
<% (1..100).each do |k| %> <% (1..100).each do |k| %>
struct test<%= k %> { struct test<%= k %> {
<% (1..n).each do |i| %> <% (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 %> <% end %>
#if defined(METABENCH) #if defined(METABENCH)
using dim = stde::units::make_dimension_t<<%= using dim = units::make_dimension_t<<%=
xs = ((1)..(n)).map { |j| "stde::units::exp<dim#{j}, 1>" } xs = ((1)..(n)).map { |j| "units::exp<dim#{j}, 1>" }
rng = Random.new(k) rng = Random.new(k)
xs.shuffle(random: rng).join(', ') xs.shuffle(random: rng).join(', ')
%>>; %>>;

View File

@@ -27,7 +27,7 @@
#include <numeric> #include <numeric>
#include <cstdint> #include <cstdint>
namespace std::experimental::units { namespace units {
namespace detail { namespace detail {
@@ -135,4 +135,4 @@ namespace std::experimental::units {
template<Ratio R1, Ratio R2> template<Ratio R1, Ratio R2>
using common_ratio = detail::common_ratio_impl<R1, R2>::type; using common_ratio = detail::common_ratio_impl<R1, R2>::type;
} // namespace std::experimental::units } // namespace units

View File

@@ -27,7 +27,7 @@
#include <numeric> #include <numeric>
#include <cstdint> #include <cstdint>
namespace std::experimental::units { namespace units {
namespace detail { namespace detail {
@@ -135,4 +135,4 @@ namespace std::experimental::units {
template<Ratio R1, Ratio R2> template<Ratio R1, Ratio R2>
using common_ratio = detail::common_ratio_impl<R1, R2>::type; using common_ratio = detail::common_ratio_impl<R1, R2>::type;
} // namespace std::experimental::units } // namespace units

View File

@@ -27,7 +27,7 @@
#include <numeric> #include <numeric>
#include <cstdint> #include <cstdint>
namespace std::experimental::units { namespace units {
namespace detail { namespace detail {
@@ -120,4 +120,4 @@ namespace std::experimental::units {
template<typename R1, typename R2> template<typename R1, typename R2>
using common_ratio = detail::common_ratio_impl<R1, R2>::type; using common_ratio = detail::common_ratio_impl<R1, R2>::type;
} // namespace std::experimental::units } // namespace units

View File

@@ -24,7 +24,7 @@
#include "type_traits.h" #include "type_traits.h"
namespace std::experimental::units { namespace units {
namespace detail { namespace detail {
@@ -182,4 +182,4 @@ namespace std::experimental::units {
template<TypeList List, template<typename, typename> typename Pred> template<TypeList List, template<typename, typename> typename Pred>
using type_list_sort = detail::type_list_sort_impl<List, Pred>::type; using type_list_sort = detail::type_list_sort_impl<List, Pred>::type;
} // namespace std::experimental::units } // namespace units

View File

@@ -24,7 +24,7 @@
#include "type_traits.h" #include "type_traits.h"
namespace std::experimental::units { namespace units {
namespace detail { namespace detail {
@@ -182,4 +182,4 @@ namespace std::experimental::units {
template<TypeList List, template<typename, typename> typename Pred> template<TypeList List, template<typename, typename> typename Pred>
using type_list_sort = detail::type_list_sort_impl<List, Pred>::type; using type_list_sort = detail::type_list_sort_impl<List, Pred>::type;
} // namespace std::experimental::units } // namespace units

View File

@@ -24,7 +24,7 @@
#include "type_traits.h" #include "type_traits.h"
namespace std::experimental::units { namespace units {
// push_front // push_front
@@ -169,4 +169,4 @@ namespace std::experimental::units {
template<typename List, template<typename, typename> typename Pred> template<typename List, template<typename, typename> typename Pred>
using type_list_sort = detail::type_list_sort_impl<List, Pred>::type; using type_list_sort = detail::type_list_sort_impl<List, Pred>::type;
} // namespace std::experimental::units } // namespace units

View File

@@ -24,7 +24,7 @@
#include <type_traits> #include <type_traits>
namespace std::experimental::units { namespace units {
namespace detail { namespace detail {

View File

@@ -1,17 +1,15 @@
#include "ratio_type_constexpr.h" #include "ratio_type_constexpr.h"
namespace stde = std::experimental;
<% (1..n).each do |i| %> <% (1..n).each do |i| %>
struct test<%= i %> { struct test<%= i %> {
#if defined(METABENCH) #if defined(METABENCH)
using r1 = stde::units::ratio<<%= 2 * i - 1 %>, <%= 2 * n %>>; using r1 = units::ratio<<%= 2 * i - 1 %>, <%= 2 * n %>>;
using r2 = stde::units::ratio<<%= 2 * i %>, <%= 2 * n %>>; using r2 = units::ratio<<%= 2 * i %>, <%= 2 * n %>>;
using r3 = stde::units::ratio_multiply<r1, r2>; using r3 = units::ratio_multiply<r1, r2>;
using r4 = stde::units::ratio_divide<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 #else
using r1 = void; using r1 = void;
using r2 = void; using r2 = void;

View File

@@ -1,7 +1,5 @@
#include "std_ratio.h" #include "std_ratio.h"
namespace stde = std::experimental;
<% (1..n).each do |i| %> <% (1..n).each do |i| %>
struct test<%= i %> { struct test<%= i %> {
#if defined(METABENCH) #if defined(METABENCH)
@@ -11,7 +9,7 @@ namespace stde = std::experimental;
using r3 = std::ratio_multiply<r1, r2>; using r3 = std::ratio_multiply<r1, r2>;
using r4 = std::ratio_divide<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 #else
using r1 = void; using r1 = void;
using r2 = void; using r2 = void;

View File

@@ -1,14 +1,12 @@
#include "ratio_type_constexpr.h" #include "ratio_type_constexpr.h"
namespace stde = std::experimental;
<% (1..n).each do |i| %> <% (1..n).each do |i| %>
struct test<%= i %> { struct test<%= i %> {
using r1 = stde::units::ratio<<%= 2 * i - 1 %>, <%= 2 * n %>>; using r1 = units::ratio<<%= 2 * i - 1 %>, <%= 2 * n %>>;
using r2 = stde::units::ratio<<%= 2 * i %>, <%= 2 * n %>>; using r2 = units::ratio<<%= 2 * i %>, <%= 2 * n %>>;
#if defined(METABENCH) #if defined(METABENCH)
using r3 = stde::units::common_ratio_t<r1, r2>; using r3 = units::common_ratio_t<r1, r2>;
#else #else
using r3 = void; using r3 = void;
#endif #endif

View File

@@ -1,14 +1,12 @@
#include "std_ratio.h" #include "std_ratio.h"
namespace stde = std::experimental;
<% (1..n).each do |i| %> <% (1..n).each do |i| %>
struct test<%= i %> { struct test<%= i %> {
using r1 = std::ratio<<%= 2 * i - 1 %>, <%= 2 * n %>>; using r1 = std::ratio<<%= 2 * i - 1 %>, <%= 2 * n %>>;
using r2 = std::ratio<<%= 2 * i %>, <%= 2 * n %>>; using r2 = std::ratio<<%= 2 * i %>, <%= 2 * n %>>;
#if defined(METABENCH) #if defined(METABENCH)
using r3 = stde::units::common_ratio_t<r1, r2>; using r3 = units::common_ratio_t<r1, r2>;
#else #else
using r3 = void; using r3 = void;
#endif #endif

View File

@@ -1,12 +1,10 @@
#include "ratio_type_constexpr.h" #include "ratio_type_constexpr.h"
namespace stde = std::experimental;
<% (1..n).each do |i| %> <% (1..n).each do |i| %>
struct test<%= i %> { struct test<%= i %> {
#if defined(METABENCH) #if defined(METABENCH)
using r1 = stde::units::ratio<<%= 2 * i - 1 %>, <%= 2 * n %>>; using r1 = units::ratio<<%= 2 * i - 1 %>, <%= 2 * n %>>;
using r2 = stde::units::ratio<<%= 2 * i %>, <%= 2 * n %>>; using r2 = units::ratio<<%= 2 * i %>, <%= 2 * n %>>;
#else #else
using r1 = void; using r1 = void;
using r2 = void; using r2 = void;

View File

@@ -1,15 +1,13 @@
#include "ratio_type_constexpr.h" #include "ratio_type_constexpr.h"
namespace stde = std::experimental;
<% (1..n).each do |i| %> <% (1..n).each do |i| %>
struct test<%= i %> { struct test<%= i %> {
using r1 = stde::units::ratio<<%= 2 * i - 1 %>, <%= 2 * n %>>; using r1 = units::ratio<<%= 2 * i - 1 %>, <%= 2 * n %>>;
using r2 = stde::units::ratio<<%= 2 * i %>, <%= 2 * n %>>; using r2 = units::ratio<<%= 2 * i %>, <%= 2 * n %>>;
#if defined(METABENCH) #if defined(METABENCH)
using r3 = stde::units::ratio_multiply<r1, r2>; using r3 = units::ratio_multiply<r1, r2>;
using r4 = stde::units::ratio_divide<r1, r2>; using r4 = units::ratio_divide<r1, r2>;
#else #else
using r3 = void; using r3 = void;
using r4 = void; using r4 = void;

View File

@@ -29,7 +29,7 @@
#define Expects(cond) if(!(cond)) ::std::terminate(); #define Expects(cond) if(!(cond)) ::std::terminate();
namespace std::experimental::units { namespace units {
namespace detail { namespace detail {
@@ -122,4 +122,4 @@ namespace std::experimental::units {
template<typename R1, typename R2> template<typename R1, typename R2>
using common_ratio_t = typename detail::common_ratio_impl<R1, R2>::type; using common_ratio_t = typename detail::common_ratio_impl<R1, R2>::type;
} // namespace std::experimental::units } // namespace units

View File

@@ -25,7 +25,7 @@
#include <ratio> #include <ratio>
#include <type_traits> #include <type_traits>
namespace std::experimental::units { namespace units {
// static_sign // static_sign
@@ -66,4 +66,4 @@ namespace std::experimental::units {
template<typename R1, typename R2> template<typename R1, typename R2>
using common_ratio_t = typename common_ratio<R1, R2>::type; using common_ratio_t = typename common_ratio<R1, R2>::type;
} // namespace std::experimental::units } // namespace units

View File

@@ -28,8 +28,6 @@
namespace { namespace {
using namespace std::experimental;
struct base_dim_digital_information { static constexpr const char* value = "digital information"; }; 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>> {}; 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 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 stde::units::downcasting_traits<stde::units::downcast_from<digital_information>> : stde::units::downcast_to<digital_information> {}; template<> struct units::downcasting_traits<units::downcast_from<::byte>> : units::downcast_to<::byte> {};
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> {};
namespace { namespace {
@@ -65,7 +61,7 @@ namespace {
namespace { namespace {
using namespace stde::units; using namespace units;
// power spectral density // power spectral density
struct power_spectral_density : make_dimension_t<units::exp<voltage, 2>, units::exp<frequency, -1>> {}; 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> {}; 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<power_spectral_density>> : downcast_to<power_spectral_density> {};
template<> struct downcasting_traits<downcast_from<sq_volt_per_hertz>> : downcast_to<sq_volt_per_hertz> {}; template<> struct downcasting_traits<downcast_from<sq_volt_per_hertz>> : downcast_to<sq_volt_per_hertz> {};

View File

@@ -23,7 +23,7 @@
#include "units/dimension.h" #include "units/dimension.h"
#include <utility> #include <utility>
using namespace std::experimental::units; using namespace units;
namespace { namespace {

View File

@@ -25,7 +25,7 @@
#include <utility> #include <utility>
#include <chrono> #include <chrono>
using namespace std::experimental::units; using namespace units;
namespace { namespace {
@@ -44,7 +44,7 @@ namespace {
} // namespace } // namespace
namespace std::experimental::units { namespace units {
template<typename T> template<typename T>
inline constexpr bool treat_as_floating_point<my_value<T>> = std::is_floating_point_v<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(); } static constexpr my_value<T> min() { return std::numeric_limits<T>::lowest(); }
}; };
} // namespace std::experimental::units } // namespace units
namespace std { namespace std {
@@ -72,7 +72,7 @@ namespace std {
namespace { namespace {
using namespace std::experimental::units; using namespace units;
// class invariants // class invariants

View File

@@ -24,7 +24,7 @@
namespace { namespace {
using namespace std::experimental::units; using namespace units;
template<Ratio R1, Ratio R2> template<Ratio R1, Ratio R2>
inline constexpr bool same = R1::num == R2::num && R1::den == R2::den; inline constexpr bool same = R1::num == R2::num && R1::den == R2::den;

View File

@@ -25,7 +25,7 @@
namespace { namespace {
using namespace std::experimental::units; using namespace units;
template<typename... Types> template<typename... Types>
struct type_list; struct type_list;

View File

@@ -46,7 +46,7 @@
namespace { namespace {
using namespace std::experimental::units; using namespace units;
/* ************** BASE DIMENSIONS **************** */ /* ************** BASE DIMENSIONS **************** */

View File

@@ -23,11 +23,10 @@
#include <units/dimensions/velocity.h> #include <units/dimensions/velocity.h>
#include <iostream> #include <iostream>
namespace stde = std::experimental; using namespace units::literals;
using namespace stde::units::literals;
template<stde::units::Length D, stde::units::Time T> template<units::Length D, units::Time T>
constexpr stde::units::Velocity avg_speed(D d, T t) constexpr units::Velocity avg_speed(D d, T t)
{ {
return d / t; return d / t;
} }