Concepts usage improved

This commit is contained in:
Mateusz Pusz committed 2018-11-10 17:10:30 -08:00
1 parent 94fd74000c
commit 297b71efcf
7 files changed
+18 -61

No files matched your search

+2 -12
View File
@@ -36,21 +36,11 @@ namespace units {
using gigahertz = unit<dimension_frequency, std::giga>;
using terahertz = unit<dimension_frequency, std::tera>;
template<Unit U = hertz, typename Rep = std::intmax_t>
template<Unit U = hertz, Number Rep = std::intmax_t>
using frequency = quantity<dimension_frequency, U, Rep>;
namespace detail {
template<typename T>
struct is_frequency : std::false_type {};
template<Unit U, typename Rep>
struct is_frequency<frequency<U, Rep>> : std::true_type {};
}
template<typename T>
concept bool Frequency = detail::is_frequency<T>::value;
concept bool Frequency = Quantity<T> && Same<typename T::dimension, dimension_frequency>;
// ...
+2 -12
View File
@@ -34,21 +34,11 @@ namespace units {
using meter = unit<dimension_length, std::ratio<1>>;
using kilometer = unit<dimension_length, std::kilo>;
template<Unit U = meter, typename Rep = std::intmax_t>
template<Unit U = meter, Number Rep = std::intmax_t>
using length = quantity<dimension_length, U, Rep>;
namespace detail {
template<typename T>
struct is_length : std::false_type {};
template<Unit U, typename Rep>
struct is_length<length<U, Rep>> : std::true_type {};
}
template<typename T>
concept bool Length = detail::is_length<T>::value;
concept bool Length = Quantity<T> && Same<typename T::dimension, dimension_length>;
namespace literals {
+2 -11
View File
@@ -36,21 +36,12 @@ namespace units {
using minute = unit<dimension_time, std::ratio<60>>;
using hour = unit<dimension_time, std::ratio<3600>>;
template<Unit U = second, typename Rep = std::intmax_t>
template<Unit U = second, Number Rep = std::intmax_t>
using time = quantity<dimension_time, U, Rep>;
namespace detail {
template<typename T>
struct is_time : std::false_type {};
template<Unit U, typename Rep>
struct is_time<time<U, Rep>> : std::true_type {};
}
template<typename T>
concept bool Time = detail::is_time<T>::value;
concept bool Time = Quantity<T> && Same<typename T::dimension, dimension_time>;
// ...
+2 -12
View File
@@ -34,21 +34,11 @@ namespace units {
using kilometer_per_hour = unit<dimension_velocity, std::ratio<1000, 3600>>;
using mile_per_hour = unit<dimension_velocity, std::ratio<44'704, 100'000>>;
template<Unit U = meter_per_second, typename Rep = std::intmax_t>
template<Unit U = meter_per_second, Number Rep = std::intmax_t>
using velocity = quantity<dimension_velocity, U, Rep>;
namespace detail {
template<typename T>
struct is_velocity : std::false_type {};
template<Unit U, typename Rep>
struct is_velocity<velocity<U, Rep>> : std::true_type {};
}
template<typename T>
concept bool Velocity = detail::is_velocity<T>::value;
concept bool Velocity = Quantity<T> && Same<typename T::dimension, dimension_velocity>;
// ...