IntegerSequence.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_INDEXSEQUENCE_H_
36 #define _BLAZE_MATH_INDEXSEQUENCE_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <utility>
44 
45 
46 namespace blaze {
47 
48 //=================================================================================================
49 //
50 // TYPE DEFINITIONS
51 //
52 //=================================================================================================
53 
54 //*************************************************************************************************
59 using std::integer_sequence;
60 //*************************************************************************************************
61 
62 
63 //*************************************************************************************************
68 using std::index_sequence;
69 //*************************************************************************************************
70 
71 
72 //*************************************************************************************************
77 using std::make_integer_sequence;
78 //*************************************************************************************************
79 
80 
81 //*************************************************************************************************
86 using std::make_index_sequence;
87 //*************************************************************************************************
88 
89 
90 
91 
92 //=================================================================================================
93 //
94 // UTILITY FUNCTIONS
95 //
96 //=================================================================================================
97 
98 //*************************************************************************************************
106 template< size_t Offset // The offset for the shift operation
107  , size_t... Is > // The sequence of indices
108 constexpr decltype(auto) shift( std::index_sequence<Is...> /*sequence*/ )
109 {
110  return std::index_sequence< ( Is + Offset )... >();
111 }
113 //*************************************************************************************************
114 
115 
116 //*************************************************************************************************
124 template< size_t... Is1 // The indices to be selected
125  , size_t... Is2 > // The sequence of indices
126 constexpr decltype(auto) subsequence( std::index_sequence<Is2...> /*sequence*/ )
127 {
128  constexpr size_t indices[] = { Is2... };
129  return std::index_sequence< indices[Is1]... >();
130 }
132 //*************************************************************************************************
133 
134 
135 
136 
137 //=================================================================================================
138 //
139 // ALIAS DEFINITIONS
140 //
141 //=================================================================================================
142 
143 //*************************************************************************************************
156 template< size_t Offset // The offset of the index sequence
157  , size_t N > // The total number of indices in the index sequence
158 using make_shifted_index_sequence = decltype( shift<Offset>( make_index_sequence<N>() ) );
159 //*************************************************************************************************
160 
161 
162 //*************************************************************************************************
175 template< size_t Offset // The offset of the index sequence
176  , size_t N // The total number of indices in the index sequence
177  , size_t ... Is > // The indices to be selected
179  decltype( subsequence<Is...>( shift<Offset>( make_index_sequence<N>() ) ) );
180 //*************************************************************************************************
181 
182 } // namespace blaze
183 
184 #endif
STL namespace.
Import of the std::make_index_sequence alias template into the Blaze namespace.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
decltype(shift< Offset >(make_index_sequence< N >())) make_shifted_index_sequence
Auxiliary alias declaration for the setup of shifted index sequences.The make_shifted_index_sequence ...
Definition: IntegerSequence.h:158
decltype(subsequence< Is... >(shift< Offset >(make_index_sequence< N >()))) make_shifted_index_subsequence
Auxiliary alias declaration for the setup of shifted index subsequences.The make_shifted_index_subseq...
Definition: IntegerSequence.h:179