18 #ifndef INTEGER_SEQUENCE_H_INCLUDED
19 #define INTEGER_SEQUENCE_H_INCLUDED
21 #include <Pb/meta_fwd.h>
28 static const size_t npos = ~0;
31 template <
size_t H,
typename T>
33 : std::integral_constant<size_t, H>
35 typedef IntegralNode<H, T> type;
36 typedef size_t value_type;
94 template <
size_t T0,
size_t T1 = 0,
size_t T2 = 0,
size_t T3 = 0,
95 size_t T4 = 0,
size_t T5 = 0,
size_t T6 = 0,
size_t T7 = 0,
96 size_t T8 = 0,
size_t T9 = 0,
size_t T10 = 0,
size_t T11 = 0,
97 size_t T12 = 0,
size_t T13 = 0,
size_t T14 = 0,
size_t T15 = 0,
98 size_t T16 = 0,
size_t T17 = 0,
size_t T18 = 0,
size_t T19 = 0,
99 size_t T20 = 0,
size_t T21 = 0,
size_t T22 = 0,
size_t T23 = 0,
100 size_t T24 = 0,
size_t T25 = 0,
size_t T26 = 0,
size_t T27 = 0,
101 size_t T28 = 0,
size_t T29 = 0,
size_t T30 = 0,
size_t T31 = 0
112 #define DECLARE_INTEGER_SEQUENCE TMP_ARRAY_32(IntegralNode<T), MT TMP_REPEAT_32(>)
113 typedef DECLARE_INTEGER_SEQUENCE type;
114 typedef size_t value_type;
116 static const size_t value = T0;
117 static const size_t count = 1;
121 #define META_INT_SEQUENCE_DEF(S) \
122 template <TMP_ARRAY_##S(size_t T)> \
123 struct integer_sequence<TMP_ARRAY_##S(T)> \
125 typedef TMP_ARRAY_##S(IntegralNode<T), MT TMP_REPEAT_##S(>) type; \
126 typedef size_t value_type; \
127 typedef typename type::tail tail; \
128 static const size_t value = type::value; \
129 static const size_t count = S; \
133 META_INT_SEQUENCE_DEF(1);
134 META_INT_SEQUENCE_DEF(2);
135 META_INT_SEQUENCE_DEF(3);
136 META_INT_SEQUENCE_DEF(4);
137 META_INT_SEQUENCE_DEF(5);
138 META_INT_SEQUENCE_DEF(6);
139 META_INT_SEQUENCE_DEF(7);
140 META_INT_SEQUENCE_DEF(8);
141 META_INT_SEQUENCE_DEF(9);
142 META_INT_SEQUENCE_DEF(10);
143 META_INT_SEQUENCE_DEF(11);
144 META_INT_SEQUENCE_DEF(12);
145 META_INT_SEQUENCE_DEF(13);
146 META_INT_SEQUENCE_DEF(14);
147 META_INT_SEQUENCE_DEF(15);
148 META_INT_SEQUENCE_DEF(16);
149 META_INT_SEQUENCE_DEF(17);
150 META_INT_SEQUENCE_DEF(18);
151 META_INT_SEQUENCE_DEF(19);
152 META_INT_SEQUENCE_DEF(20);
153 META_INT_SEQUENCE_DEF(21);
154 META_INT_SEQUENCE_DEF(22);
155 META_INT_SEQUENCE_DEF(23);
156 META_INT_SEQUENCE_DEF(24);
157 META_INT_SEQUENCE_DEF(25);
158 META_INT_SEQUENCE_DEF(26);
159 META_INT_SEQUENCE_DEF(27);
160 META_INT_SEQUENCE_DEF(28);
161 META_INT_SEQUENCE_DEF(29);
162 META_INT_SEQUENCE_DEF(30);
163 META_INT_SEQUENCE_DEF(31);
167 #undef META_INT_SEQUENCE_DEF
171 template <
typename SeqT>
173 : std::integral_constant< size_t, SeqT::value>
179 : std::integral_constant< size_t, 0>
183 template <
typename SeqT>
186 typedef typename SeqT::tail type;
199 template <
typename SeqT>
201 : Front <typename PopFront<SeqT>::type>
209 : std::integral_constant<size_t, 0>
215 template <
typename SeqT>
217 : std::integral_constant< bool,
218 empty_type < typename PopFront<SeqT>::type>::value
219 || 0 == TailValue<SeqT>::value
236 template <
typename SeqT>
239 typedef typename PopFront<SeqT>::type type;
254 template<
typename SeqT,
258 : std::integral_constant< size_t,
259 at< typename GetTail<SeqT>::type,
268 template<
typename SeqT >
270 : std::integral_constant<size_t, Front<SeqT>::value>
276 template<
size_t IdxT >
278 : std::integral_constant<size_t, 0>
286 : std::integral_constant<size_t, 0>
292 template<
typename ToT,
297 typename GetTail<FromT>::type
304 template<
typename ToT >
313 template<
typename SeqT >
322 template<
typename SeqT,
326 : std::integral_constant< size_t,
327 value_if< ValueT == Front<SeqT>::value,
330 find< typename GetTail<SeqT>::type,
341 template<
size_t ValueT >
343 : std::integral_constant< size_t, Hg::npos >
349 template<
typename SeqT,
353 : std::integral_constant< bool,
354 find<SeqT, ValueT>::value != Hg::npos