16#ifndef CABANA_MEMBERTYPES_HPP
17#define CABANA_MEMBERTYPES_HPP
26template <
typename... Types>
30 static constexpr std::size_t
size =
sizeof...( Types );
36struct is_member_types_impl :
public std::false_type
40template <
typename... Types>
41struct is_member_types_impl<MemberTypes<Types...>> :
public std::true_type
49 :
public is_member_types_impl<typename std::remove_cv<T>::type>::type
57template <std::size_t M,
typename T,
typename... Types>
58struct MemberTypeAtIndexImpl;
60template <
typename T,
typename... Types>
61struct MemberTypeAtIndexImpl<0, T, Types...>
66template <std::size_t M,
typename T,
typename... Types>
67struct MemberTypeAtIndexImpl
69 using type =
typename MemberTypeAtIndexImpl<M - 1, Types...>::type;
74template <std::size_t M,
typename... Types>
78template <std::size_t M,
typename... Types>
82 using type =
typename MemberTypeAtIndexImpl<M, Types...>
::type;
89template <std::size_t M,
typename T,
typename... Types>
90struct CheckMemberTypesImpl;
92template <
typename T,
typename... Types>
93struct CheckMemberTypesImpl<0, T, Types...>
96 static_assert( std::is_trivial<type>::value,
97 "Member types must be trivial" );
99 using value_type =
typename std::remove_all_extents<type>::type;
100 static_assert( std::is_arithmetic<value_type>::value,
101 "Member value types must be arithmetic" );
104 static constexpr bool value =
true;
107template <std::size_t M,
typename T,
typename... Types>
108struct CheckMemberTypesImpl
111 static_assert( std::is_trivial<type>::value,
112 "Member types must be trivial" );
114 using value_type =
typename std::remove_all_extents<type>::type;
115 static_assert( std::is_arithmetic<value_type>::value,
116 "Member value types must be arithmetic" );
118 static constexpr bool value = CheckMemberTypesImpl<M - 1, Types...>::value;
123template <
typename... Types>
127template <
typename... Types>
Core: particle data structures and algorithms.
Definition Cabana_AoSoA.hpp:36
static constexpr bool value
Valid member type.
Definition Cabana_MemberTypes.hpp:133
static constexpr int size
Type size.
Definition Cabana_MemberTypes.hpp:131
Check that member types are valid.
Definition Cabana_MemberTypes.hpp:124
typename MemberTypeAtIndexImpl< M, Types... >::type type
Member type.
Definition Cabana_MemberTypes.hpp:82
Get the type of the member at a given index.
Definition Cabana_MemberTypes.hpp:75
General sequence of types for SoA and AoSoA member data.
Definition Cabana_MemberTypes.hpp:28
static constexpr std::size_t size
Definition Cabana_MemberTypes.hpp:30
Static type checker.
Definition Cabana_MemberTypes.hpp:50