28 #ifndef VC_TRAITS_TYPE_TRAITS_H_
29 #define VC_TRAITS_TYPE_TRAITS_H_
31 #include <type_traits>
33 #include "has_no_allocated_data.h"
34 #include "has_contiguous_storage.h"
35 #include "is_initializer_list.h"
36 #include "is_load_arguments.h"
37 #include "is_functor_argument_immutable.h"
38 #include "is_output_iterator.h"
39 #include "is_index_sequence.h"
40 #include "is_implicit_cast_allowed.h"
42 namespace Vc_VERSIONED_NAMESPACE
45 struct enable_if_default_type
47 constexpr enable_if_default_type() {}
49 static constexpr enable_if_default_type nullarg;
50 template <
bool Test,
typename T = enable_if_default_type>
using enable_if =
typename std::enable_if<Test, T>::type;
54 #include "has_subscript_operator.h"
55 #include "has_multiply_operator.h"
56 #include "has_addition_operator.h"
57 #include "has_equality_operator.h"
59 template<
typename T>
struct is_simd_mask_internal :
public std::false_type {};
60 template<
typename T>
struct is_simd_vector_internal :
public std::false_type {};
61 template<
typename T>
struct is_subscript_operation_internal :
public std::false_type {};
62 template<
typename T>
struct is_simdarray_internal :
public std::false_type {};
63 template<
typename T>
struct is_simd_mask_array_internal :
public std::false_type {};
64 template<
typename T>
struct is_loadstoreflag_internal :
public std::false_type {};
66 #include "is_gather_signature.h"
68 template <std::size_t,
typename... Args>
struct is_cast_arguments_internal :
public std::false_type {};
69 template <
typename Arg>
70 struct is_cast_arguments_internal<1, Arg> :
public std::integral_constant<
72 is_simdarray_internal<Arg>::value ||
73 is_simd_vector_internal<Arg>::value>
77 template <typename T, bool = is_simd_vector_internal<T>::value>
struct is_integral_internal;
78 template <typename T, bool = is_simd_vector_internal<T>::value>
struct is_floating_point_internal;
79 template <typename T, bool = is_simd_vector_internal<T>::value>
struct is_signed_internal;
80 template <typename T, bool = is_simd_vector_internal<T>::value>
struct is_unsigned_internal;
82 template <
typename T>
struct is_integral_internal <T, false> :
public std::is_integral <T> {};
83 template <
typename T>
struct is_floating_point_internal<T, false> :
public std::is_floating_point<T> {};
84 template <
typename T>
struct is_signed_internal <T, false> :
public std::is_signed <T> {};
85 template <
typename T>
struct is_unsigned_internal <T, false> :
public std::is_unsigned <T> {};
87 template <
typename V>
struct is_integral_internal <V, true> :
public std::is_integral <typename V::EntryType> {};
88 template <
typename V>
struct is_floating_point_internal<V, true> :
public std::is_floating_point<typename V::EntryType> {};
89 template <
typename V>
struct is_signed_internal <V, true> :
public std::is_signed <typename V::EntryType> {};
90 template <
typename V>
struct is_unsigned_internal <V, true> :
public std::is_unsigned <typename V::EntryType> {};
93 struct is_arithmetic_internal
94 :
public std::integral_constant<
96 (is_floating_point_internal<T>::value || is_integral_internal<T>::value)>
100 template <
typename T,
101 bool = (is_simd_vector_internal<T>::value || is_simd_mask_internal<T>::value ||
102 is_simdarray_internal<T>::value ||
103 is_simd_mask_array_internal<T>::value)>
104 struct vector_size_internal;
106 template <
typename T>
107 struct vector_size_internal<T, true> :
public std::integral_constant<std::size_t, T::Size>
110 template <
typename T>
111 struct vector_size_internal<T, false> :
public std::integral_constant<std::size_t, 0>
121 template <
typename T>
123 (is_simd_mask_internal<decay<T>>::value ||
124 is_simd_mask_array_internal<decay<T>>::value)>
132 template <
typename T>
134 :
public std::integral_constant<bool,
135 (is_simd_vector_internal<decay<T>>::value ||
136 is_simdarray_internal<decay<T>>::value)>
141 template <
typename T>
147 template <
typename T>
153 template <
typename T>
struct is_subscript_operation :
public is_subscript_operation_internal<decay<T>> {};
155 template <
typename T>
struct is_load_store_flag :
public is_loadstoreflag_internal<decay<T>> {};
157 template <
typename... Args>
struct is_cast_arguments :
public is_cast_arguments_internal<sizeof...(Args), decay<Args>...> {};
160 template <
typename T>
struct is_atomic_simdarray_internal :
public std::false_type {};
161 template <
typename T>
using isAtomicSimdArray = is_atomic_simdarray_internal<decay<T>>;
164 template <
typename T>
struct is_atomic_simd_mask_array_internal :
public std::false_type {};
165 template <
typename T>
using isAtomicSimdMaskArray = is_atomic_simd_mask_array_internal<decay<T>>;
173 template <
typename T>
struct is_integral :
public is_integral_internal<decay<T>> {};
174 template <
typename T>
struct is_floating_point :
public is_floating_point_internal<decay<T>> {};
175 template <
typename T>
struct is_arithmetic :
public is_arithmetic_internal<decay<T>> {};
176 template <
typename T>
struct is_signed :
public is_signed_internal<decay<T>> {};
177 template <
typename T>
struct is_unsigned :
public is_unsigned_internal<decay<T>> {};
179 template <
typename T,
bool IsSimdVector>
struct scalar_type_internal {
using type = T; };
180 template <
typename T>
struct scalar_type_internal<T, true> {
using type =
typename T::EntryType; };
181 template <
typename T>
using scalar_type =
typename scalar_type_internal<decay<T>, is_simd_vector<T>::value>::type;
186 #include "entry_type_of.h"
188 #endif // VC_TRAITS_TYPE_TRAITS_H_
Identifies any possible SimdArray type (independent of const/volatile or reference) ...
Identifies any possible SimdMaskArray type (independent of const/volatile or reference) ...
The value member will either be the number of SIMD vector entries or 0 if T is not a SIMD type...
Identifies any SIMD vector type (independent of implementation or whether it's SimdArray).
Identifies any SIMD mask type (independent of implementation or whether it's SimdMaskArray).