RAJA
RAJA provides a collection of platform portability abstractions for C++ HPC applications.
Template.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 #ifndef RAJA_pattern_kernel_internal_Template_HPP
21 #define RAJA_pattern_kernel_internal_Template_HPP
22 
23 #include "camp/camp.hpp"
24 
25 namespace RAJA
26 {
27 namespace internal
28 {
29 
30 namespace detail
31 {
32 // Helper class to convert a camp::idx_t into some type T
33 // used in template expansion in ListOfNHelper
34 template<typename T, camp::idx_t>
35 struct SeqToType
36 {
37  using type = T;
38 };
39 
40 template<typename T, typename SEQ>
42 
43 template<typename T, camp::idx_t... SEQ>
44 struct ListOfNHelper<T, camp::idx_seq<SEQ...>>
45 {
46  using type = camp::list<typename SeqToType<T, SEQ>::type...>;
47 };
48 
49 
50 template<typename T, typename SEQ>
52 
53 template<typename T, camp::idx_t... SEQ>
54 struct TupleOfNHelper<T, camp::idx_seq<SEQ...>>
55 {
56  using type = camp::tuple<typename SeqToType<T, SEQ>::type...>;
57 };
58 
59 } // namespace detail
60 
61 /*
62  * This creates a camp::list with N types, each one being T.
63  *
64  * That is, list_of_n<T, 4> == camp::list<T, T, T, T>
65  *
66  */
67 template<typename T, camp::idx_t N>
68 using list_of_n =
70 
71 
72 /*
73  * This creates a camp::tuple with N types, each one being T.
74  *
75  * That is, tuple_of_n<T, 4> == camp::tuple<T, T, T, T>
76  *
77  */
78 template<typename T, camp::idx_t N>
79 using tuple_of_n =
81 
82 
83 } // end namespace internal
84 } // end namespace RAJA
85 
86 
87 #endif /* RAJA_pattern_kernel_internal_Template_HPP */
typename detail::TupleOfNHelper< T, camp::make_idx_seq_t< N > >::type tuple_of_n
Definition: Template.hpp:80
typename detail::ListOfNHelper< T, camp::make_idx_seq_t< N > >::type list_of_n
Definition: Template.hpp:69
Definition: AlignedRangeIndexSetBuilders.cpp:35
camp::list< typename SeqToType< T, SEQ >::type... > type
Definition: Template.hpp:46
Definition: Template.hpp:41
Definition: Template.hpp:36
T type
Definition: Template.hpp:37
camp::tuple< typename SeqToType< T, SEQ >::type... > type
Definition: Template.hpp:56
Definition: Template.hpp:51