3#ifndef included_AMP_TypeTraits
4#define included_AMP_TypeTraits
10#include "AMP/utils/ArraySize.h"
23template<
typename T>
struct is_vector : std::false_type {};
24template<
typename T>
struct is_vector<
std::vector<T>> : std::true_type {};
27template<
typename T>
struct is_array : std::false_type {};
28template<
typename T, std::
size_t N>
struct is_array<
std::array<T, N>> : std::true_type {};
31template<
typename>
struct is_pair : std::false_type {};
32template<
typename T,
typename U>
struct is_pair<
std::pair<T, U>> : std::true_type {};
35template<
typename T>
struct is_Array : std::false_type {};
40template<
typename T>
struct is_Array<Array<T,GPUFunctionTable<T>,CudaDevAllocator<T>>> : std::true_type {};
43template<
typename T>
struct is_Array<Array<T,GPUFunctionTable<T>,HipManagedAllocator<T>>> : std::true_type {};
44template<
typename T>
struct is_Array<Array<T,GPUFunctionTable<T>,HipDevAllocator<T>>> : std::true_type {};
48template<
typename T>
struct is_string : std::false_type {};
51template<>
struct is_string<char *> : std::true_type {};
52template<std::
size_t N>
struct is_string<char[N]> : std::true_type {};
58 typedef std::true_type
yes;
59 typedef std::false_type
no;
60 template<
typename U>
static auto test(
int ) ->
decltype( std::declval<U>().size() == 1,
yes() );
61 template<
typename>
static no test( ... );
68template<
typename T,
typename =
void>
struct has_begin : std::false_type {};
69template<
typename T>
struct has_begin<T, decltype( void(
std::begin( std::declval<T &>() ) ) )> : std::true_type {};
70template<
typename T,
typename =
void>
struct has_end : std::false_type {};
71template<
typename T>
struct has_end<T, decltype( void(
std::end( std::declval<T &>() ) ) )> : std::true_type {};
72template<
typename T,
typename =
void>
struct has_empty : std::false_type {};
73template<
typename T>
struct has_empty<T, decltype( void(
std::empty( std::declval<T &>() ) ) )> : std::true_type {};
80template<
class T>
struct is_complex :
public std::false_type {};
84template<
class T>
struct is_complex<
std::complex<T>> :
public std::true_type {};
98template<
class T>
constexpr bool is_container_v = has_begin_v<T> && has_end_v<T> && has_empty_v<T>;
104 std::is_integral_v<T1> && std::is_integral_v<T2> &&
105 ( std::is_signed_v<T1> == std::is_signed_v<T2> ) && (
sizeof( T1 ) ==
sizeof( T2 ) );
108template<
typename T>
using remove_cvref_t =
typename std::remove_cv_t<typename std::remove_reference_t<T>>;
112template<
typename T,
typename... Args>
113struct arg_count<T( Args... )> {
static constexpr std::size_t value =
sizeof...( Args ); };
Allocator based on cudaMallocManaged.
constexpr bool is_vector_v
constexpr bool is_unique_ptr_v
constexpr bool has_begin_v
constexpr bool is_container_v
constexpr bool is_array_v
constexpr bool arg_count_v
constexpr bool is_Array_v
constexpr bool is_complex_v
constexpr bool is_initializer_list_v
constexpr bool has_empty_v
std::allocator< TYPE > HostAllocator
constexpr bool is_string_v
typename std::remove_cv_t< typename std::remove_reference_t< T > > remove_cvref_t
constexpr bool has_size_v
constexpr bool is_same_int_v
Checks whether two types are both integers of the same size and sign.
constexpr bool is_shared_ptr_v
Checks whether T has a size() function.
static auto test(int) -> decltype(std::declval< U >().size()==1, yes())
static constexpr bool value
Checks whether T is an AMP::Array.
Checks whether T is a std::array.
Checks whether T is complex.
Checks whether T is an initializer_list.
Checks whether T is a shared_ptr.
Checks whether T is convertible to a string.
Checks whether T is a unique_ptr.
Checks whether T is a std::vector.