IntegerSequence.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_INTEGERSEQUENCE_H_
36 #define _BLAZE_MATH_INTEGERSEQUENCE_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 // GLOBAL OPERATORS
95 //
96 //=================================================================================================
97 
98 //*************************************************************************************************
106 template< size_t... I1s, size_t... I2s > //
107 constexpr bool operator==( index_sequence<I1s...> lhs, index_sequence<I2s...> rhs ) noexcept
108 {
109  UNUSED_PARAMETER( lhs, rhs );
110 
111  return false;
112 }
113 //*************************************************************************************************
114 
115 
116 //*************************************************************************************************
125 template< size_t... I1s > //
126 constexpr bool operator==( index_sequence<I1s...> lhs, index_sequence<I1s...> rhs ) noexcept
127 {
128  UNUSED_PARAMETER( lhs, rhs );
129 
130  return true;
131 }
133 //*************************************************************************************************
134 
135 
136 //*************************************************************************************************
144 template< size_t... I1s, size_t... I2s >
145 constexpr bool operator!=( index_sequence<I1s...> lhs, index_sequence<I2s...> rhs ) noexcept
146 {
147  UNUSED_PARAMETER( lhs, rhs );
148 
149  return !( lhs == rhs );
150 }
151 //*************************************************************************************************
152 
153 
154 
155 
156 //=================================================================================================
157 //
158 // UTILITY FUNCTIONS
159 //
160 //=================================================================================================
161 
162 //*************************************************************************************************
170 template< size_t Offset // The offset for the shift operation
171  , size_t... Is > // The sequence of indices
172 constexpr decltype(auto) shift( std::index_sequence<Is...> /*sequence*/ )
173 {
174  return std::index_sequence< ( Is + Offset )... >();
175 }
177 //*************************************************************************************************
178 
179 
180 //*************************************************************************************************
188 template< size_t... Is1 // The indices to be selected
189  , size_t... Is2 > // The sequence of indices
190 constexpr decltype(auto) subsequence( std::index_sequence<Is2...> /*sequence*/ )
191 {
192  constexpr size_t indices[] = { Is2... };
193  return std::index_sequence< indices[Is1]... >();
194 }
196 //*************************************************************************************************
197 
198 
199 
200 
201 //=================================================================================================
202 //
203 // ALIAS DEFINITIONS
204 //
205 //=================================================================================================
206 
207 //*************************************************************************************************
220 template< size_t Offset // The offset of the index sequence
221  , size_t N > // The total number of indices in the index sequence
222 using make_shifted_index_sequence = decltype( shift<Offset>( make_index_sequence<N>() ) );
223 //*************************************************************************************************
224 
225 
226 //*************************************************************************************************
239 template< size_t Offset // The offset of the index sequence
240  , size_t N // The total number of indices in the index sequence
241  , size_t ... Is > // The indices to be selected
243  decltype( subsequence<Is...>( shift<Offset>( make_index_sequence<N>() ) ) );
244 //*************************************************************************************************
245 
246 } // namespace blaze
247 
248 #endif
Index sequence type of the Blaze library.
constexpr void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
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
constexpr bool operator==(const NegativeAccuracy< A > &lhs, const T &rhs)
Equality comparison between a NegativeAccuracy object and a floating point value. ...
Definition: Accuracy.h:253
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:222
constexpr bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:293
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:243