forked from mpusz/mp-units
refactor: has_common_type_v
simplified
This commit is contained in:
@@ -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 =
|
||||||
|
Reference in New Issue
Block a user