1 #ifndef BL_TYPETRAITS_H_
2 #define BL_TYPETRAITS_H_
3 #include <AMReX_Config.H>
10 #define AMREX_IS_TRIVIALLY_COPYABLE(T) std::is_trivially_copyable_v<T>
11 #define AMREX_IS_TRIVIALLY_DEFAULT_CONSTRUCTIBLE(T) std::is_trivially_default_constructible_v<T>
15 template <
class T>
class BaseFab;
16 template <
class FAB>
class FabArray;
18 template <
class A,
class Enable =
void>
struct IsBaseFab : std::false_type {};
22 std::is_base_of_v<BaseFab<typename D::value_type>,
29 template <
class A,
class Enable =
void>
struct IsFabArray : std::false_type {};
33 std::is_base_of_v<FabArray<typename D::FABType::value_type>,
40 template <
class M,
class Enable =
void>
45 IsBaseFab_v<typename M::fab_type> > >
52 template <
bool B,
class T =
void>
55 template <
class T,
class Enable =
void>
60 template <>
struct HasAtomicAdd<unsigned long long> : std::true_type {};
68 #ifdef AMREX_PARTICLES
84 struct IsParticleIterator :
public std::is_base_of<MFIter, T>::type {};
87 struct IsParticleContainer :
public std::is_base_of<ParticleContainerBase, T>::type {};
92 template <
class T,
class Enable =
void>
95 template <
class T,
class Enable =
void>
98 template <
class T,
class Enable =
void>
101 #if defined(AMREX_USE_CUDA) && defined(__NVCC__)
105 : std::false_type {};
108 struct DefinitelyNotHostRunnable<T, std::enable_if_t<__nv_is_extended_device_lambda_closure_type(T)> >
111 #elif defined(AMREX_USE_HIP)
119 template <
typename T,
typename U1,
typename... Us>
122 template <
typename T,
typename U>
125 static constexpr
bool value = std::is_same_v<T,U>;
128 template <
typename T,
typename U1,
typename... Us>
157 template <
class Default,
class AlwaysVoid,
template <
class...>
class Op,
164 template <
class Default,
template <
class...>
class Op,
class... Args>
171 template <
template <
class...>
class Op,
class... Args>
174 template <
template <
class...>
class Op,
class... Args>
177 template <
class Default,
template <
class...>
class Op,
class... Args>
180 template <
class Expected,
template <
typename...>
class Op,
class... Args>
187 template <
typename T,
typename... Args>
200 template <
typename T,
typename... Args>
206 template <
typename R,
typename T,
typename... Args>
216 #if defined(__cpp_lib_logical_traits)
217 template <
typename... Args>
using Conjunction = std::conjunction<Args...>;
218 template <
typename... Args>
using Disjunction = std::disjunction<Args...>;
219 template <
typename... Args>
using Negation = std::negation<Args...>;
220 #elif defined(__cpp_lib_experimental_logical_traits)
221 template <
typename... Args>
using Conjunction = std::experimental::conjunction<Args...>;
222 template <
typename... Args>
using Disjunction = std::experimental::disjunction<Args...>;
223 template <
typename... Args>
using Negation = std::experimental::negation<Args...>;
227 template <
class B1,
class... Bn>
229 : std::conditional_t<bool(B1::value), Conjunction<Bn...>, B1> {};
233 template <
class B1,
class... Bn>
235 : std::conditional_t<bool(B1::value), B1, Disjunction<Bn...>> {};
238 using Negation = std::integral_constant<bool, !bool(B::value)>;
248 template <
typename T,
typename U,
typename Enable =
void>
251 template <
typename T,
typename U>
252 struct IsConvertibleImp<T, U, std::enable_if_t<is_convertible<T>(U{})>> : std::true_type {};
256 template <
typename T,
typename... Args>
261 template <
typename T,
typename... Args>
265 template <
class T,
class Enable =
void>
270 std::is_arithmetic_v<T>
271 && sizeof(T) <= 8 > >
274 template <
class T,
class Enable =
void>
275 struct IsStdVector : std::false_type {};
278 struct IsStdVector<T, std::enable_if_t<std::is_base_of_v<std::vector<typename T::value_type,
279 typename T::allocator_type>,
Definition: AMReX_MFIter.H:57
Definition: AMReX_ParticleContainerBase.H:23
static constexpr GPUBinPolicy Default
Definition: AMReX_DenseBins.H:24
void Void_t
Definition: AMReX_TypeTraits.H:146
constexpr bool is_convertible(T)
Definition: AMReX_TypeTraits.H:246
decltype(std::declval< T >()(std::declval< Args >()...)) call_result_t
Definition: AMReX_TypeTraits.H:188
static constexpr int M
Definition: AMReX_OpenBC.H:13
Definition: AMReX_Amr.cpp:49
constexpr bool IsFabArray_v
Definition: AMReX_TypeTraits.H:38
std::integral_constant< bool, !bool(B::value)> Negation
Definition: AMReX_TypeTraits.H:238
constexpr bool IsMultiFabLike_v
Definition: AMReX_TypeTraits.H:49
typename detail::Detector< detail::Nonesuch, void, Op, Args... >::type Detected_t
Definition: AMReX_TypeTraits.H:175
constexpr bool IsConvertible_v
Definition: AMReX_TypeTraits.H:262
constexpr bool IsBaseFab_v
Definition: AMReX_TypeTraits.H:27
typename detail::Detector< Default, void, Op, Args... >::type DetectedOr
Definition: AMReX_TypeTraits.H:178
const int[]
Definition: AMReX_BLProfiler.cpp:1664
std::enable_if_t< B, T > EnableIf_t
Definition: AMReX_TypeTraits.H:53
typename detail::Detector< detail::Nonesuch, void, Op, Args... >::value_t IsDetected
Definition: AMReX_TypeTraits.H:172
std::is_same< Expected, Detected_t< Op, Args... > > IsDetectedExact
Definition: AMReX_TypeTraits.H:181
Definition: AMReX_FabArrayCommI.H:896
Definition: AMReX_TypeTraits.H:226
Logical traits let us combine multiple type requirements in one enable_if_t clause.
Definition: AMReX_TypeTraits.H:225
Definition: AMReX_TypeTraits.H:99
Definition: AMReX_TypeTraits.H:232
Definition: AMReX_TypeTraits.H:231
Definition: AMReX_TypeTraits.H:56
Definition: AMReX_TypeTraits.H:18
Test if a given type T is callable with arguments of type Args...
Definition: AMReX_TypeTraits.H:207
Test if a given type T is callable with arguments of type Args...
Definition: AMReX_TypeTraits.H:201
Test if all the types Args... are automatically convertible to type T.
Definition: AMReX_TypeTraits.H:257
static constexpr bool value
Definition: AMReX_TypeTraits.H:258
Definition: AMReX_TypeTraits.H:29
Definition: AMReX_TypeTraits.H:66
Definition: AMReX_TypeTraits.H:41
Definition: AMReX_TypeTraits.H:266
Definition: AMReX_TypeTraits.H:93
Definition: AMReX_TypeTraits.H:96
Definition: AMReX_TypeTraits.H:130
static constexpr bool value
Definition: AMReX_TypeTraits.H:131
std::true_type value_t
Definition: AMReX_TypeTraits.H:166
Op< Args... > type
Definition: AMReX_TypeTraits.H:167
Definition: AMReX_TypeTraits.H:159
std::false_type value_t
Definition: AMReX_TypeTraits.H:160
Default type
Definition: AMReX_TypeTraits.H:161
Definition: AMReX_TypeTraits.H:249
Definition: AMReX_TypeTraits.H:148
void operator=(Nonesuch &&)=delete
void operator=(Nonesuch const &)=delete
Nonesuch(Nonesuch const &)=delete
Nonesuch(Nonesuch &&)=delete