dimension_traits and unit_traits merged as upcasting_traits

This commit is contained in:
Mateusz Pusz committed 2018-11-17 12:39:45 +01:00
1 parent 45f7b4f19f
commit ee7518d0a1
8 files changed
+41 -48

No files matched your search

+7 -7
View File
@@ -28,25 +28,25 @@
namespace units {
struct dimension_frequency : make_dimension_t<exp<base_dim_time, -1>> {};
template<> struct dimension_traits<typename dimension_frequency::base_type> : std::type_identity<dimension_frequency> {};
template<> struct upcasting_traits<typename dimension_frequency::base_type> : std::type_identity<dimension_frequency> {};
struct millihertz : unit<dimension_frequency, std::milli> {};
template<> struct unit_traits<typename millihertz::base_type> : std::type_identity<millihertz> {};
template<> struct upcasting_traits<typename millihertz::base_type> : std::type_identity<millihertz> {};
struct hertz : unit<dimension_frequency, std::ratio<1>> {};
template<> struct unit_traits<typename hertz::base_type> : std::type_identity<hertz> {};
template<> struct upcasting_traits<typename hertz::base_type> : std::type_identity<hertz> {};
struct kilohertz : unit<dimension_frequency, std::kilo> {};
template<> struct unit_traits<typename kilohertz::base_type> : std::type_identity<kilohertz> {};
template<> struct upcasting_traits<typename kilohertz::base_type> : std::type_identity<kilohertz> {};
struct megahertz : unit<dimension_frequency, std::mega> {};
template<> struct unit_traits<typename megahertz::base_type> : std::type_identity<megahertz> {};
template<> struct upcasting_traits<typename megahertz::base_type> : std::type_identity<megahertz> {};
struct gigahertz : unit<dimension_frequency, std::giga> {};
template<> struct unit_traits<typename gigahertz::base_type> : std::type_identity<gigahertz> {};
template<> struct upcasting_traits<typename gigahertz::base_type> : std::type_identity<gigahertz> {};
struct terahertz : unit<dimension_frequency, std::tera> {};
template<> struct unit_traits<typename terahertz::base_type> : std::type_identity<terahertz> {};
template<> struct upcasting_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>;
+5 -5
View File
@@ -28,19 +28,19 @@
namespace units {
struct dimension_length : make_dimension_t<exp<base_dim_length, 1>> {};
template<> struct dimension_traits<typename dimension_length::base_type> : std::type_identity<dimension_length> {};
template<> struct upcasting_traits<typename dimension_length::base_type> : std::type_identity<dimension_length> {};
struct millimeter : unit<dimension_length, std::milli> {};
template<> struct unit_traits<typename millimeter::base_type> : std::type_identity<millimeter> {};
template<> struct upcasting_traits<typename millimeter::base_type> : std::type_identity<millimeter> {};
struct centimeter : unit<dimension_length, std::ratio<1, 100>> {};
template<> struct unit_traits<typename centimeter::base_type> : std::type_identity<centimeter> {};
template<> struct upcasting_traits<typename centimeter::base_type> : std::type_identity<centimeter> {};
struct meter : unit<dimension_length, std::ratio<1>> {};
template<> struct unit_traits<typename meter::base_type> : std::type_identity<meter> {};
template<> struct upcasting_traits<typename meter::base_type> : std::type_identity<meter> {};
struct kilometer : unit<dimension_length, std::kilo> {};
template<> struct unit_traits<typename kilometer::base_type> : std::type_identity<kilometer> {};
template<> struct upcasting_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>;
+7 -7
View File
@@ -28,25 +28,25 @@
namespace units {
struct dimension_time : make_dimension_t<exp<base_dim_time, 1>> {};
template<> struct dimension_traits<typename dimension_time::base_type> : std::type_identity<dimension_time> {};
template<> struct upcasting_traits<typename dimension_time::base_type> : std::type_identity<dimension_time> {};
struct nanosecond : unit<dimension_time, std::nano> {};
template<> struct unit_traits<typename nanosecond::base_type> : std::type_identity<nanosecond> {};
template<> struct upcasting_traits<typename nanosecond::base_type> : std::type_identity<nanosecond> {};
struct microsecond : unit<dimension_time, std::micro> {};
template<> struct unit_traits<typename microsecond::base_type> : std::type_identity<microsecond> {};
template<> struct upcasting_traits<typename microsecond::base_type> : std::type_identity<microsecond> {};
struct millisecond : unit<dimension_time, std::milli> {};
template<> struct unit_traits<typename millisecond::base_type> : std::type_identity<millisecond> {};
template<> struct upcasting_traits<typename millisecond::base_type> : std::type_identity<millisecond> {};
struct second : unit<dimension_time, std::ratio<1>> {};
template<> struct unit_traits<typename second::base_type> : std::type_identity<second> {};
template<> struct upcasting_traits<typename second::base_type> : std::type_identity<second> {};
struct minute : unit<dimension_time, std::ratio<60>> {};
template<> struct unit_traits<typename minute::base_type> : std::type_identity<minute> {};
template<> struct upcasting_traits<typename minute::base_type> : std::type_identity<minute> {};
struct hour : unit<dimension_time, std::ratio<3600>> {};
template<> struct unit_traits<typename hour::base_type> : std::type_identity<hour> {};
template<> struct upcasting_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>;
+4 -4
View File
@@ -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::base_type> : std::type_identity<dimension_velocity> {};
template<> struct upcasting_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::base_type> : std::type_identity<meter_per_second> {};
template<> struct upcasting_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::base_type> : std::type_identity<kilometer_per_hour> {};
template<> struct upcasting_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::base_type> : std::type_identity<mile_per_hour> {};
template<> struct upcasting_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>;