Strong dimensions support added
This commit is contained in:
1 parent
297b71efcf
commit
7205dc2cb9
7 files changed
+50
-17
No files matched your search
@@ -27,7 +27,6 @@
|
||||
|
||||
namespace units {
|
||||
|
||||
using dimension_frequency = make_dimension_t<exp<base_dim_time, -1>>;
|
||||
|
||||
using millihertz = unit<dimension_frequency, std::milli>;
|
||||
using hertz = unit<dimension_frequency, std::ratio<1>>;
|
||||
@@ -35,6 +34,8 @@ namespace units {
|
||||
using megahertz = unit<dimension_frequency, std::mega>;
|
||||
using gigahertz = unit<dimension_frequency, std::giga>;
|
||||
using terahertz = unit<dimension_frequency, std::tera>;
|
||||
struct dimension_frequency : make_dimension_t<exp<base_dim_time, -1>> {};
|
||||
template<> struct dimension_traits<typename dimension_frequency::type> : std::type_identity<dimension_frequency> {};
|
||||
|
||||
template<Unit U = hertz, Number Rep = std::intmax_t>
|
||||
using frequency = quantity<dimension_frequency, U, Rep>;
|
||||
|
||||
@@ -27,7 +27,8 @@
|
||||
|
||||
namespace units {
|
||||
|
||||
using dimension_length = make_dimension_t<exp<base_dim_length, 1>>;
|
||||
struct dimension_length : make_dimension_t<exp<base_dim_length, 1>> {};
|
||||
template<> struct dimension_traits<typename dimension_length::type> : std::type_identity<dimension_length> {};
|
||||
|
||||
using millimeter = unit<dimension_length, std::milli>;
|
||||
using centimeter = unit<dimension_length, std::ratio<1, 100>>;
|
||||
|
||||
@@ -27,14 +27,15 @@
|
||||
|
||||
namespace units {
|
||||
|
||||
using dimension_time = make_dimension_t<exp<base_dim_time, 1>>;
|
||||
|
||||
using nanosecond = unit<dimension_time, std::nano>;
|
||||
using microsecond = unit<dimension_time, std::micro>;
|
||||
using millisecond = unit<dimension_time, std::milli>;
|
||||
using second = unit<dimension_time, std::ratio<1>>;
|
||||
using minute = unit<dimension_time, std::ratio<60>>;
|
||||
using hour = unit<dimension_time, std::ratio<3600>>;
|
||||
struct dimension_time : make_dimension_t<exp<base_dim_time, 1>> {};
|
||||
template<> struct dimension_traits<typename dimension_time::type> : std::type_identity<dimension_time> {};
|
||||
|
||||
|
||||
template<Unit U = second, Number Rep = std::intmax_t>
|
||||
using time = quantity<dimension_time, U, Rep>;
|
||||
|
||||
@@ -28,7 +28,8 @@
|
||||
|
||||
namespace units {
|
||||
|
||||
using dimension_velocity = make_dimension_t<exp<base_dim_length, 1>, exp<base_dim_time, -1>>;
|
||||
struct dimension_velocity : make_dimension_t<exp<base_dim_length, 1>, exp<base_dim_time, -1>> {};
|
||||
template<> struct dimension_traits<typename dimension_velocity::type> : std::type_identity<dimension_velocity> {};
|
||||
|
||||
using meter_per_second = unit<dimension_velocity, std::ratio<1>>;
|
||||
using kilometer_per_hour = unit<dimension_velocity, std::ratio<1000, 3600>>;
|
||||
|
||||
Reference in new issue
Block a user