Blaze  3.6
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 #include <blaze/util/MaybeUnused.h>
45 
46 
47 namespace blaze {
48 
49 //=================================================================================================
50 //
51 // TYPE DEFINITIONS
52 //
53 //=================================================================================================
54 
55 //*************************************************************************************************
60 using std::integer_sequence;
61 //*************************************************************************************************
62 
63 
64 //*************************************************************************************************
69 using std::index_sequence;
70 //*************************************************************************************************
71 
72 
73 //*************************************************************************************************
78 using std::make_integer_sequence;
79 //*************************************************************************************************
80 
81 
82 //*************************************************************************************************
87 using std::make_index_sequence;
88 //*************************************************************************************************
89 
90 
91 
92 
93 //=================================================================================================
94 //
95 // GLOBAL OPERATORS
96 //
97 //=================================================================================================
98 
99 //*************************************************************************************************
107 template< size_t... I1s, size_t... I2s > //
108 constexpr bool operator==( index_sequence<I1s...> lhs, index_sequence<I2s...> rhs ) noexcept
109 {
110  MAYBE_UNUSED( lhs, rhs );
111 
112  return false;
113 }
114 //*************************************************************************************************
115 
116 
117 //*************************************************************************************************
126 template< size_t... I1s > //
127 constexpr bool operator==( index_sequence<I1s...> lhs, index_sequence<I1s...> rhs ) noexcept
128 {
129  MAYBE_UNUSED( lhs, rhs );
130 
131  return true;
132 }
134 //*************************************************************************************************
135 
136 
137 //*************************************************************************************************
145 template< size_t... I1s, size_t... I2s >
146 constexpr bool operator!=( index_sequence<I1s...> lhs, index_sequence<I2s...> rhs ) noexcept
147 {
148  MAYBE_UNUSED( lhs, rhs );
149 
150  return !( lhs == rhs );
151 }
152 //*************************************************************************************************
153 
154 
155 
156 
157 //=================================================================================================
158 //
159 // UTILITY FUNCTIONS
160 //
161 //=================================================================================================
162 
163 //*************************************************************************************************
171 template< size_t Offset // The offset for the shift operation
172  , size_t... Is > // The sequence of indices
173 constexpr decltype(auto) shift( std::index_sequence<Is...> sequence )
174 {
175  MAYBE_UNUSED( sequence );
176 
177  return std::index_sequence< ( Is + Offset )... >();
178 }
180 //*************************************************************************************************
181 
182 
183 //*************************************************************************************************
191 template< size_t... Is1 // The indices to be selected
192  , size_t... Is2 > // The sequence of indices
193 constexpr decltype(auto) subsequence( std::index_sequence<Is2...> sequence )
194 {
195  MAYBE_UNUSED( sequence );
196 
197  constexpr size_t indices[] = { Is2... };
198  return std::index_sequence< indices[Is1]... >();
199 }
201 //*************************************************************************************************
202 
203 
204 
205 
206 //=================================================================================================
207 //
208 // ALIAS DEFINITIONS
209 //
210 //=================================================================================================
211 
212 //*************************************************************************************************
225 template< size_t Offset // The offset of the index sequence
226  , size_t N > // The total number of indices in the index sequence
227 using make_shifted_index_sequence = decltype( shift<Offset>( make_index_sequence<N>() ) );
228 //*************************************************************************************************
229 
230 
231 //*************************************************************************************************
244 template< size_t Offset // The offset of the index sequence
245  , size_t N // The total number of indices in the index sequence
246  , size_t ... Is > // The indices to be selected
248  decltype( subsequence<Is...>( shift<Offset>( make_index_sequence<N>() ) ) );
249 //*************************************************************************************************
250 
251 } // namespace blaze
252 
253 #endif
Header file for the MAYBE_UNUSED function template.
Index sequence type of the Blaze library.
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
constexpr void MAYBE_UNUSED(const Args &...)
Suppression of unused parameter warnings.
Definition: MaybeUnused.h:81
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:227
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:248