RAJA
RAJA provides a collection of platform portability abstractions for C++ HPC applications.
TypeTraits.hpp
Go to the documentation of this file.
1 
11 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
12 // Copyright (c) Lawrence Livermore National Security, LLC and other
13 // RAJA Project Developers. See top-level LICENSE and COPYRIGHT
14 // files for dates and other details. No copyright assignment is required
15 // to contribute to RAJA.
16 //
17 // SPDX-License-Identifier: (BSD-3-Clause)
18 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
19 
20 
21 #ifndef RAJA_TYPETRAITS_HPP
22 #define RAJA_TYPETRAITS_HPP
23 
24 #include <type_traits>
25 #include <camp/camp.hpp>
26 
27 namespace RAJA
28 {
29 namespace expt
30 {
31 //===========================================================================
32 //
33 //
34 // Forward declarations for types used by type trait helpers
35 //
36 //
37 
38 // Forward declaration of ForallParamPack
39 template<typename... Params>
40 struct ForallParamPack;
41 
42 // Forward declaration of Reducer
43 namespace detail
44 {
45 template<typename Op, typename T, typename VOp>
46 struct Reducer;
47 }
48 
49 //===========================================================================
50 //
51 //
52 // Type traits for SFINAE work.
53 //
54 //
55 namespace type_traits
56 {
57 template<typename T>
58 struct is_ForallParamPack : std::false_type
59 {};
60 
61 template<typename... Args>
62 struct is_ForallParamPack<ForallParamPack<Args...>> : std::true_type
63 {};
64 
65 template<typename T>
66 struct is_ForallParamPack_empty : std::true_type
67 {};
68 
69 template<typename First, typename... Rest>
71  : std::false_type
72 {};
73 
74 template<>
75 struct is_ForallParamPack_empty<ForallParamPack<>> : std::true_type
76 {};
77 } // namespace type_traits
78 
79 template<typename T>
80 struct is_instance_of_Reducer : std::false_type
81 {};
82 
83 template<typename Op, typename T, typename VOp>
84 struct is_instance_of_Reducer<detail::Reducer<Op, T, VOp>> : std::true_type
85 {};
86 
87 template<typename T>
88 struct tuple_contains_Reducers : std::false_type
89 {};
90 
91 template<typename... Params>
92 struct tuple_contains_Reducers<camp::tuple<Params...>>
93  : std::integral_constant<
94  bool,
95  camp::concepts::any_of<is_instance_of_Reducer<Params>...>::value>
96 {};
97 
98 } // namespace expt
99 } // namespace RAJA
100 
101 #endif // RAJA_TYPETRAITS_HPP
Definition: AlignedRangeIndexSetBuilders.cpp:35
camp::list< internal::LambdaArg< internal::lambda_arg_param_t, args >... > Params
Definition: Lambda.hpp:95
Definition: forall.hpp:140
Definition: reducer.hpp:80
Definition: TypeTraits.hpp:81
Definition: TypeTraits.hpp:89
Definition: TypeTraits.hpp:59