8 #ifndef DXLE_TYPE_TRAITS_FLOAT_PROMOTE_HPP 9 #define DXLE_TYPE_TRAITS_FLOAT_PROMOTE_HPP 11 #include <type_traits> 17 namespace type_traits {
19 template<
typename T>
struct float_promote1 :
public std::conditional<std::is_floating_point<T>::value, T, double>
22 std::is_arithmetic<T>::value,
23 "float_promote requires arithmetic type." 26 template<typename T, typename U, bool is_arithmetic = std::is_arithmetic<T>::value && std::is_arithmetic<U>::value>
29 std::is_arithmetic<T>::value && std::is_arithmetic<U>::value,
30 "float_promote requires arithmetic type." 33 template<
typename T,
typename U>
37 enable_if<(std::is_same<T, long double>::value || std::is_same<U, long double>::value),
long double>,
38 enable_if<(std::is_same<T, float>::value && std::is_same<U, float>::value),
float>,
44 template<
typename T,
typename U,
typename... Tail>
47 typename dxle::type_traits::detail::float_promote2<T, U>::type,
60 template<
typename... Types>
63 typename std::remove_cv<Types>::type...
67 template<
typename... Types>
70 using namespace type_traits;
73 #endif // #ifndef DXLE_TYPE_TRAITS_FLOAT_PROMOTE_HPP typename dxle::float_promote< Types... >::type float_promote_t
first_enabled_t< enable_if<(std::is_same< T, long double >::value||std::is_same< U, long double >::value), long double >, enable_if<(std::is_same< T, float >::value &&std::is_same< U, float >::value), float >, double > type
typename first_enabled< Args... >::type first_enabled_t