Inheritance hierarchy helpers for dimension and unit made more descriptive
This commit is contained in:
1 parent
db64a3e6a1
commit
58e1eefd3b
6 files changed
+35
-32
No files matched your search
@@ -28,25 +28,25 @@
|
||||
namespace units {
|
||||
|
||||
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<> struct dimension_traits<typename dimension_frequency::base_type> : std::type_identity<dimension_frequency> {};
|
||||
|
||||
struct millihertz : unit<dimension_frequency, std::milli> {};
|
||||
template<> struct unit_traits<typename millihertz::type> : std::type_identity<millihertz> {};
|
||||
template<> struct unit_traits<typename millihertz::base_type> : std::type_identity<millihertz> {};
|
||||
|
||||
struct hertz : unit<dimension_frequency, std::ratio<1>> {};
|
||||
template<> struct unit_traits<typename hertz::type> : std::type_identity<hertz> {};
|
||||
template<> struct unit_traits<typename hertz::base_type> : std::type_identity<hertz> {};
|
||||
|
||||
struct kilohertz : unit<dimension_frequency, std::kilo> {};
|
||||
template<> struct unit_traits<typename kilohertz::type> : std::type_identity<kilohertz> {};
|
||||
template<> struct unit_traits<typename kilohertz::base_type> : std::type_identity<kilohertz> {};
|
||||
|
||||
struct megahertz : unit<dimension_frequency, std::mega> {};
|
||||
template<> struct unit_traits<typename megahertz::type> : std::type_identity<megahertz> {};
|
||||
template<> struct unit_traits<typename megahertz::base_type> : std::type_identity<megahertz> {};
|
||||
|
||||
struct gigahertz : unit<dimension_frequency, std::giga> {};
|
||||
template<> struct unit_traits<typename gigahertz::type> : std::type_identity<gigahertz> {};
|
||||
template<> struct unit_traits<typename gigahertz::base_type> : std::type_identity<gigahertz> {};
|
||||
|
||||
struct terahertz : unit<dimension_frequency, std::tera> {};
|
||||
template<> struct unit_traits<typename terahertz::type> : std::type_identity<terahertz> {};
|
||||
template<> struct unit_traits<typename terahertz::base_type> : std::type_identity<terahertz> {};
|
||||
|
||||
template<Unit U = hertz, Number Rep = std::intmax_t>
|
||||
using frequency = quantity<dimension_frequency, U, Rep>;
|
||||
|
||||
@@ -28,19 +28,19 @@
|
||||
namespace units {
|
||||
|
||||
struct dimension_length : make_dimension_t<exp<base_dim_length, 1>> {};
|
||||
template<> struct dimension_traits<typename dimension_length::type> : std::type_identity<dimension_length> {};
|
||||
template<> struct dimension_traits<typename dimension_length::base_type> : std::type_identity<dimension_length> {};
|
||||
|
||||
struct millimeter : unit<dimension_length, std::milli> {};
|
||||
template<> struct unit_traits<typename millimeter::type> : std::type_identity<millimeter> {};
|
||||
template<> struct unit_traits<typename millimeter::base_type> : std::type_identity<millimeter> {};
|
||||
|
||||
struct centimeter : unit<dimension_length, std::ratio<1, 100>> {};
|
||||
template<> struct unit_traits<typename centimeter::type> : std::type_identity<centimeter> {};
|
||||
template<> struct unit_traits<typename centimeter::base_type> : std::type_identity<centimeter> {};
|
||||
|
||||
struct meter : unit<dimension_length, std::ratio<1>> {};
|
||||
template<> struct unit_traits<typename meter::type> : std::type_identity<meter> {};
|
||||
template<> struct unit_traits<typename meter::base_type> : std::type_identity<meter> {};
|
||||
|
||||
struct kilometer : unit<dimension_length, std::kilo> {};
|
||||
template<> struct unit_traits<typename kilometer::type> : std::type_identity<kilometer> {};
|
||||
template<> struct unit_traits<typename kilometer::base_type> : std::type_identity<kilometer> {};
|
||||
|
||||
template<Unit U = meter, Number Rep = std::intmax_t>
|
||||
using length = quantity<dimension_length, U, Rep>;
|
||||
|
||||
@@ -28,25 +28,25 @@
|
||||
namespace units {
|
||||
|
||||
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<> struct dimension_traits<typename dimension_time::base_type> : std::type_identity<dimension_time> {};
|
||||
|
||||
struct nanosecond : unit<dimension_time, std::nano> {};
|
||||
template<> struct unit_traits<typename nanosecond::type> : std::type_identity<nanosecond> {};
|
||||
template<> struct unit_traits<typename nanosecond::base_type> : std::type_identity<nanosecond> {};
|
||||
|
||||
struct microsecond : unit<dimension_time, std::micro> {};
|
||||
template<> struct unit_traits<typename microsecond::type> : std::type_identity<microsecond> {};
|
||||
template<> struct unit_traits<typename microsecond::base_type> : std::type_identity<microsecond> {};
|
||||
|
||||
struct millisecond : unit<dimension_time, std::milli> {};
|
||||
template<> struct unit_traits<typename millisecond::type> : std::type_identity<millisecond> {};
|
||||
template<> struct unit_traits<typename millisecond::base_type> : std::type_identity<millisecond> {};
|
||||
|
||||
struct second : unit<dimension_time, std::ratio<1>> {};
|
||||
template<> struct unit_traits<typename second::type> : std::type_identity<second> {};
|
||||
template<> struct unit_traits<typename second::base_type> : std::type_identity<second> {};
|
||||
|
||||
struct minute : unit<dimension_time, std::ratio<60>> {};
|
||||
template<> struct unit_traits<typename minute::type> : std::type_identity<minute> {};
|
||||
template<> struct unit_traits<typename minute::base_type> : std::type_identity<minute> {};
|
||||
|
||||
struct hour : unit<dimension_time, std::ratio<3600>> {};
|
||||
template<> struct unit_traits<typename hour::type> : std::type_identity<hour> {};
|
||||
template<> struct unit_traits<typename hour::base_type> : std::type_identity<hour> {};
|
||||
|
||||
template<Unit U = second, Number Rep = std::intmax_t>
|
||||
using time = quantity<dimension_time, U, Rep>;
|
||||
|
||||
@@ -29,16 +29,16 @@
|
||||
namespace units {
|
||||
|
||||
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> {};
|
||||
template<> struct dimension_traits<typename dimension_velocity::base_type> : std::type_identity<dimension_velocity> {};
|
||||
|
||||
struct meter_per_second : unit<dimension_velocity, std::ratio<1>> {};
|
||||
template<> struct unit_traits<typename meter_per_second::type> : std::type_identity<meter_per_second> {};
|
||||
template<> struct unit_traits<typename meter_per_second::base_type> : std::type_identity<meter_per_second> {};
|
||||
|
||||
struct kilometer_per_hour : unit<dimension_velocity, std::ratio<1000, 3600>> {};
|
||||
template<> struct unit_traits<typename kilometer_per_hour::type> : std::type_identity<kilometer_per_hour> {};
|
||||
template<> struct unit_traits<typename kilometer_per_hour::base_type> : std::type_identity<kilometer_per_hour> {};
|
||||
|
||||
struct mile_per_hour : unit<dimension_velocity, std::ratio<44'704, 100'000>> {};
|
||||
template<> struct unit_traits<typename mile_per_hour::type> : std::type_identity<mile_per_hour> {};
|
||||
template<> struct unit_traits<typename mile_per_hour::base_type> : std::type_identity<mile_per_hour> {};
|
||||
|
||||
template<Unit U = meter_per_second, Number Rep = std::intmax_t>
|
||||
using velocity = quantity<dimension_velocity, U, Rep>;
|
||||
|
||||
Reference in new issue
Block a user