10 #ifndef vtk_m_internal_ArrayPortalHelpers_h
11 #define vtk_m_internal_ArrayPortalHelpers_h
25 template <
typename PortalType>
26 struct PortalSupportsGetsImpl
28 template <typename U, typename S = decltype(std::declval<U>().Get(
vtkm::Id{}))>
29 static std::true_type has(
int);
31 static std::false_type has(...);
32 using type = decltype(has<PortalType>(0));
35 template <
typename PortalType>
36 struct PortalSupportsGets3DImpl
38 template <typename U, typename S = decltype(std::declval<U>().Get(
vtkm::Id3{}))>
39 static std::true_type has(
int);
41 static std::false_type has(...);
42 using type = decltype(has<PortalType>(0));
45 template <
typename PortalType>
46 struct PortalSupportsSetsImpl
49 typename S = decltype(std::declval<U>().Set(
vtkm::Id{},
50 std::declval<typename U::ValueType>()))>
51 static std::true_type has(
int);
53 static std::false_type has(...);
54 using type = decltype(has<PortalType>(0));
57 template <
typename PortalType>
58 struct PortalSupportsSets3DImpl
61 typename S = decltype(std::declval<U>().Set(
vtkm::Id3{},
62 std::declval<typename U::ValueType>()))>
63 static std::true_type has(
int);
65 static std::false_type has(...);
66 using type = decltype(has<PortalType>(0));
69 template <
typename PortalType>
70 struct PortalSupportsIteratorsImpl
72 template <typename U, typename S = decltype(std::declval<U>().GetIteratorBegin())>
73 static std::true_type has(
int);
75 static std::false_type has(...);
76 using type = decltype(has<PortalType>(0));
81 template <
typename PortalType>
82 using PortalSupportsGets =
83 typename detail::PortalSupportsGetsImpl<typename std::decay<PortalType>::type>::type;
85 template <
typename PortalType>
86 using PortalSupportsGets3D =
87 typename detail::PortalSupportsGets3DImpl<typename std::decay<PortalType>::type>::type;
89 template <
typename PortalType>
90 using PortalSupportsSets =
91 typename detail::PortalSupportsSetsImpl<typename std::decay<PortalType>::type>::type;
93 template <
typename PortalType>
94 using PortalSupportsSets3D =
95 typename detail::PortalSupportsSets3DImpl<typename std::decay<PortalType>::type>::type;
97 template <
typename PortalType>
98 using PortalSupportsIterators =
99 typename detail::PortalSupportsIteratorsImpl<typename std::decay<PortalType>::type>::type;
103 #endif //vtk_m_internal_ArrayPortalHelpers_h