refactor: has_common_type_v simplified

This commit is contained in:
Mateusz Pusz
2024-09-10 18:48:11 +02:00
parent 8103a4039f
commit 3e31067ce4

View File

@@ -30,17 +30,8 @@
namespace mp_units::detail { namespace mp_units::detail {
template<typename AlwaysVoid, typename... Ts>
struct has_common_type_impl : std::false_type {};
template<typename... Ts> template<typename... Ts>
struct has_common_type_impl<std::void_t<std::common_type_t<Ts...>>, Ts...> : std::true_type {}; constexpr bool has_common_type_v = requires { typename std::common_type_t<Ts...>; };
template<typename... Ts>
using has_common_type = typename has_common_type_impl<void, Ts...>::type;
template<typename... Ts>
constexpr bool has_common_type_v = has_common_type_impl<void, Ts...>::value;
template<typename T, typename Other> template<typename T, typename Other>
using maybe_common_type = using maybe_common_type =