Type Traits
xsimd provides a few type traits to interact with scalar and batch types in an uniform manner.
Combined traits:
|
batch types and proprties |
Type check:
|
batch type detection |
|
mask batch type detection |
|
complex batch type detection |
Type access:
|
batch element type |
|
batch mask type |
-
template<class T>
struct batch_traits - #include <xsimd_traits.hpp>
type traits that provide information about a batch or scalar type.
- Template Parameters:
T – type to analyze.
-
template<class T>
struct is_batch : public std::integral_constant<bool, batch_traits<T>::is_batch> - #include <xsimd_traits.hpp>
type traits that inherits from
std::true_typeforbatch<...>types and fromstd::false_typeotherwise.- Template Parameters:
T – type to analyze.
-
template<class T>
struct is_batch_bool : public std::integral_constant<bool, batch_traits<T>::is_batch_bool> - #include <xsimd_traits.hpp>
type traits that inherits from
std::true_typeforbatch_bool<...>types and fromstd::false_typeotherwise.- Template Parameters:
T – type to analyze.
-
template<class T>
struct is_any_batch : public std::integral_constant<bool, batch_traits<T>::is_any_batch> - #include <xsimd_traits.hpp>
type traits that inherits from
std::true_typeforbatch<...>or batch_bool<…> types and fromstd::false_typeotherwise.- Template Parameters:
T – type to analyze.
-
template<class T>
struct is_batch_complex : public std::integral_constant<bool, batch_traits<T>::is_batch && batch_traits<T>::is_complex> - #include <xsimd_traits.hpp>
type traits that inherits from
std::true_typeforbatch<std::complex<...>>types and fromstd::false_typeotherwise.- Template Parameters:
T – type to analyze.
-
template<class T>
struct scalar_type - #include <xsimd_traits.hpp>
type traits whose
typefield is set toT::value_typeifis_batch<T>::valueand toTotherwise.- Template Parameters:
T – type to analyze.
-
template<class T>
struct mask_type - #include <xsimd_traits.hpp>
type traits whose
typefield is set toT::value_typeifis_batch_bool<T>::valueand toboolotherwise.- Template Parameters:
T – type to analyze.