23 template <
typename _type>
struct is_ratio : std::false_type {};
25 template <
intmax_t _num,
intmax_t _den>
26 struct is_ratio<std::ratio<_num, _den>> : std::true_type {};
28 template <
typename _type>
32 template <
typename _ratio_lhs,
typename _ratio_rhs>
struct ratio_gcd {
34 using gcd_num = std::integral_constant<std::intmax_t,
35 std::gcd<std::intmax_t, std::intmax_t>(
36 _ratio_lhs::num, _ratio_rhs::num)>;
38 using gcd_den = std::integral_constant<std::intmax_t,
39 std::gcd<std::intmax_t, std::intmax_t>(
40 _ratio_lhs::den, _ratio_rhs::den)>;
43 using ratio = std::ratio<gcd_num::value, (_ratio_lhs::den / gcd_den::value) *
48 template <
char _symbol,
typename _exponent,
typename _type,
typename _ratio>
53 template <
typename _unit>
struct is_unit_t : std::false_type {};
56 template <
char _symbol,
typename _exponent,
typename _ratio,
typename _type>
61 template <
char _symbol,
typename _exponent,
typename _ratio,
typename _type>
64 template <
typename _type>
Namespace containing implementation details for SI.
Definition: acceleration.h:34
constexpr bool is_ratio_v
Definition: detail.h:29
constexpr bool is_unit_t_v
Definition: detail.h:65
to check if a template is an instantiation of std::ratio
Definition: detail.h:23
calculate gcd for rations
Definition: detail.h:32
std::ratio< gcd_num::value,(_ratio_lhs::den/gcd_den::value) *_ratio_rhs::den > ratio
Definition: detail.h:44
base template class for holding values of type _type to be multiplied with a ratio _ratio
Definition: unit.h:51