From 5e657bac702a0d0e97a6d12f45e2c142dd75c9cc Mon Sep 17 00:00:00 2001 From: Jonas Hoppe <162709928+czjhoppe@users.noreply.github.com> Date: Fri, 30 Aug 2024 13:26:38 +0200 Subject: [PATCH] [msvc][fix] msvc complains about requires expression (no common type found) replace with concept has_common_type --- src/core/include/mp-units/bits/sudo_cast.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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; /**