diff --git a/src/core/include/mp-units/bits/sudo_cast.h b/src/core/include/mp-units/bits/sudo_cast.h index fd7a9973..0db70246 100644 --- a/src/core/include/mp-units/bits/sudo_cast.h +++ b/src/core/include/mp-units/bits/sudo_cast.h @@ -30,11 +30,22 @@ namespace mp_units::detail { +template +struct has_common_type_impl : std::false_type {}; + +template +struct has_common_type_impl>, Ts...> : std::true_type {}; + +template +using has_common_type = typename has_common_type_impl::type; + +template constexpr bool has_common_type_v = has_common_type_impl::value; + template struct get_common_type : std::common_type {}; template -using maybe_common_type = MP_UNITS_TYPENAME std::conditional_t; }, +using maybe_common_type = MP_UNITS_TYPENAME std::conditional_t, get_common_type, std::type_identity>::type; /**