libqi-api  2.1.4.13
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
preproc.hpp
Go to the documentation of this file.
1 #pragma once
2 /*
3  * Copyright (C) 2009-2012, Aldebaran Robotics.
4  * Imported from urbi-sdk's libport.
5  *
6  */
7 
8 #ifndef _QI_PREPROC_HPP_
9 #define _QI_PREPROC_HPP_
10 
11 # include <boost/preprocessor/seq/for_each.hpp>
12 # include <boost/preprocessor/seq/remove.hpp>
13 # include <boost/preprocessor/seq/transform.hpp>
14 
15 # define QI_MAP_HELPER(R, Macro, Elt) (Macro(Elt))
16 # define QI_MAP(Macro, Seq) \
18  BOOST_PP_SEQ_FOR_EACH(QI_MAP_HELPER, Macro, Seq)
19 
20 # define QI_APPLY_HELPER(R, Macro, Elt) Macro(Elt)
21 # define QI_APPLY(Macro, Seq) \
23  BOOST_PP_SEQ_FOR_EACH(QI_APPLY_HELPER, Macro, Seq)
24 
25 
26 # define QI_SEPARATE_HELPER(Elt) , Elt
27 # define QI_SEPARATE(Seq) \
29  BOOST_PP_SEQ_HEAD(Seq) \
30  QI_APPLY(QI_SEPARATE_HELPER, BOOST_PP_SEQ_TAIL(Seq))
31 
33 # define QI_ENUM(Seq, Sep) \
34  BOOST_PP_SEQ_HEAD(Seq) \
35  BOOST_PP_SEQ_FOR_EACH(QI_ENUM_HELPER, Sep, BOOST_PP_SEQ_TAIL(Seq))
36 # define QI_ENUM_HELPER(Data, Sep, Elt) Sep Elt
37 
40 # define QI_ENUM_PRETTY(Seq, Sep, LSep) \
41  BOOST_PP_CAT( \
42  QI_ENUM_PRETTY_, \
43  BOOST_PP_IF(BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(Seq)), SEVERAL, ONE)) \
44  (Seq, Sep, LSep)
45 # define QI_ENUM_PRETTY_ONE(Seq, Sep, LSep) \
46  BOOST_PP_SEQ_HEAD(Seq)
47 # define QI_ENUM_PRETTY_SEVERAL(Seq, Sep, LSep) \
48  QI_ENUM(QI_RTAIL(Seq), Sep) LSep QI_RHEAD(Seq)
49 
51 # define QI_RHEAD(Seq) BOOST_PP_SEQ_ELEM(BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(Seq)), Seq)
52 # define QI_RTAIL(Seq) BOOST_PP_SEQ_REMOVE(Seq, BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(Seq)))
54 
56 # ifdef _MSC_VER
57 
58 # define QI_CAT(A, B) QI_CAT_0(A, B)
59 /*
60 #!/usr/bin/python
61 
62 for i in range(0, 32):
63  print '# define QI_CAT_%s(A, B) QI_CAT_%s(A, B)' % (i, i + 1)
64 */
65 # define QI_CAT_0(A, B) QI_CAT_1(A, B)
66 # define QI_CAT_1(A, B) QI_CAT_2(A, B)
67 # define QI_CAT_2(A, B) QI_CAT_3(A, B)
68 # define QI_CAT_3(A, B) QI_CAT_4(A, B)
69 # define QI_CAT_4(A, B) QI_CAT_5(A, B)
70 # define QI_CAT_5(A, B) QI_CAT_6(A, B)
71 # define QI_CAT_6(A, B) QI_CAT_7(A, B)
72 # define QI_CAT_7(A, B) QI_CAT_8(A, B)
73 # define QI_CAT_8(A, B) QI_CAT_9(A, B)
74 # define QI_CAT_9(A, B) QI_CAT_10(A, B)
75 # define QI_CAT_10(A, B) QI_CAT_11(A, B)
76 # define QI_CAT_11(A, B) QI_CAT_12(A, B)
77 # define QI_CAT_12(A, B) QI_CAT_13(A, B)
78 # define QI_CAT_13(A, B) QI_CAT_14(A, B)
79 # define QI_CAT_14(A, B) QI_CAT_15(A, B)
80 # define QI_CAT_15(A, B) QI_CAT_16(A, B)
81 # define QI_CAT_16(A, B) QI_CAT_17(A, B)
82 # define QI_CAT_17(A, B) QI_CAT_18(A, B)
83 # define QI_CAT_18(A, B) QI_CAT_19(A, B)
84 # define QI_CAT_19(A, B) QI_CAT_20(A, B)
85 # define QI_CAT_20(A, B) QI_CAT_21(A, B)
86 # define QI_CAT_21(A, B) QI_CAT_22(A, B)
87 # define QI_CAT_22(A, B) QI_CAT_23(A, B)
88 # define QI_CAT_23(A, B) QI_CAT_24(A, B)
89 # define QI_CAT_24(A, B) QI_CAT_25(A, B)
90 # define QI_CAT_25(A, B) QI_CAT_26(A, B)
91 # define QI_CAT_26(A, B) QI_CAT_27(A, B)
92 # define QI_CAT_27(A, B) QI_CAT_28(A, B)
93 # define QI_CAT_28(A, B) QI_CAT_29(A, B)
94 # define QI_CAT_29(A, B) QI_CAT_30(A, B)
95 # define QI_CAT_30(A, B) QI_CAT_31(A, B)
96 # define QI_CAT_31(A, B) A ## B
97 # else
98 # define QI_CAT(A, B) QI_CAT_(A, B)
99 # define QI_CAT_(A, B) A ## B
100 # endif
101 
103 # define __HERE \
104  __FILE__ ":" BOOST_PP_STRINGIZE(__LINE__)
105 
106 # define QI_ID(...) __VA_ARGS__
107 
108 # define QI_DELAY(X) X
109 
110 # define QI_COMMA ,
111 
112 # define QI_WRAP(...) (__VA_ARGS__)
113 
114 # define QI_UNWRAP(...) QI_ID __VA_ARGS__
115 
116 
117 /*
118 #!/usr/bin/python
119 
120 def gen(n):
121  print '#define QI_LIST_BUILD_%(max)s(%(formals)s IGNORED) %(list)s' % {
122  'formals' : ''.join(map(lambda i: 'A%s,' % i, range(n))),
123  'list' : ''.join(map(lambda i: '(A%s)' % i, range(n))),
124  'max' : n,
125  }
126 
127 for i in range(10):
128  gen(i)
129 */
130 
131 #define QI_LIST_BUILD_0( IGNORED)
132 #define QI_LIST_BUILD_1(A0, IGNORED) \
133  (A0)
134 #define QI_LIST_BUILD_2(A0,A1, IGNORED) \
135  (A0)(A1)
136 #define QI_LIST_BUILD_3(A0,A1,A2, IGNORED) \
137  (A0)(A1)(A2)
138 #define QI_LIST_BUILD_4(A0,A1,A2,A3, IGNORED) \
139  (A0)(A1)(A2)(A3)
140 #define QI_LIST_BUILD_5(A0,A1,A2,A3,A4, IGNORED) \
141  (A0)(A1)(A2)(A3)(A4)
142 #define QI_LIST_BUILD_6(A0,A1,A2,A3,A4,A5, IGNORED) \
143  (A0)(A1)(A2)(A3)(A4)(A5)
144 #define QI_LIST_BUILD_7(A0,A1,A2,A3,A4,A5,A6, IGNORED) \
145  (A0)(A1)(A2)(A3)(A4)(A5)(A6)
146 #define QI_LIST_BUILD_8(A0,A1,A2,A3,A4,A5,A6,A7, IGNORED) \
147  (A0)(A1)(A2)(A3)(A4)(A5)(A6)(A7)
148 #define QI_LIST_BUILD_9(A0,A1,A2,A3,A4,A5,A6,A7,A8, IGNORED) \
149  (A0)(A1)(A2)(A3)(A4)(A5)(A6)(A7)(A8)
150 #define QI_LIST_BUILD_10(A0,A1,A2,A3,A4,A5,A6,A7,A8,A9, IGNORED) \
151  (A0)(A1)(A2)(A3)(A4)(A5)(A6)(A7)(A8)(A9)
152 #define QI_LIST_BUILD_11(A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10, IGNORED) \
153  (A0)(A1)(A2)(A3)(A4)(A5)(A6)(A7)(A8)(A9)(A10)
154 #define QI_LIST_BUILD_12(A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11, IGNORED) \
155  (A0)(A1)(A2)(A3)(A4)(A5)(A6)(A7)(A8)(A9)(A10)(A11)
156 #define QI_LIST_BUILD_13(A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12, IGNORED) \
157  (A0)(A1)(A2)(A3)(A4)(A5)(A6)(A7)(A8)(A9)(A10)(A11)(A12)
158 #define QI_LIST_BUILD_14(A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13, IGNORED) \
159  (A0)(A1)(A2)(A3)(A4)(A5)(A6)(A7)(A8)(A9)(A10)(A11)(A12)(A13)
160 #define QI_LIST_BUILD_15(A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14, IGNORED) \
161  (A0)(A1)(A2)(A3)(A4)(A5)(A6)(A7)(A8)(A9)(A10)(A11)(A12)(A13)(A14)
162 #define QI_LIST_BUILD_16(A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15, IGNORED) \
163  (A0)(A1)(A2)(A3)(A4)(A5)(A6)(A7)(A8)(A9)(A10)(A11)(A12)(A13)(A14)(A15)
164 #define QI_LIST_BUILD_17(A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15,A16, IGNORED) \
165  (A0)(A1)(A2)(A3)(A4)(A5)(A6)(A7)(A8)(A9)(A10)(A11)(A12)(A13)(A14)(A15)(A16)
166 #define QI_LIST_BUILD_18(A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15,A16,A17, IGNORED) \
167  (A0)(A1)(A2)(A3)(A4)(A5)(A6)(A7)(A8)(A9)(A10)(A11)(A12)(A13)(A14)(A15)(A16)(A17)
168 #define QI_LIST_BUILD_19(A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15,A16,A17,A18, IGNORED) \
169  (A0)(A1)(A2)(A3)(A4)(A5)(A6)(A7)(A8)(A9)(A10)(A11)(A12)(A13)(A14)(A15)(A16)(A17)(A18)
170 #define QI_LIST_BUILD_20(A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15,A16,A17,A18,A19, IGNORED) \
171  (A0)(A1)(A2)(A3)(A4)(A5)(A6)(A7)(A8)(A9)(A10)(A11)(A12)(A13)(A14)(A15)(A16)(A17)(A18)(A19)
172 #define QI_LIST_BUILD_21(A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15,A16,A17,A18,A19,A20, IGNORED) \
173  (A0)(A1)(A2)(A3)(A4)(A5)(A6)(A7)(A8)(A9)(A10)(A11)(A12)(A13)(A14)(A15)(A16)(A17)(A18)(A19)(A20)
174 #define QI_LIST_BUILD_22(A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15,A16,A17,A18,A19,A20,A21, IGNORED) \
175  (A0)(A1)(A2)(A3)(A4)(A5)(A6)(A7)(A8)(A9)(A10)(A11)(A12)(A13)(A14)(A15)(A16)(A17)(A18)(A19)(A20)(A21)
176 #define QI_LIST_BUILD_23(A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15,A16,A17,A18,A19,A20,A21,A22, IGNORED) \
177  (A0)(A1)(A2)(A3)(A4)(A5)(A6)(A7)(A8)(A9)(A10)(A11)(A12)(A13)(A14)(A15)(A16)(A17)(A18)(A19)(A20)(A21)(A22)
178 #define QI_LIST_BUILD_24(A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15,A16,A17,A18,A19,A20,A21,A22,A23, IGNORED) \
179  (A0)(A1)(A2)(A3)(A4)(A5)(A6)(A7)(A8)(A9)(A10)(A11)(A12)(A13)(A14)(A15)(A16)(A17)(A18)(A19)(A20)(A21)(A22)(A23)
180 #define QI_LIST_BUILD_25(A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15,A16,A17,A18,A19,A20,A21,A22,A23,A24, IGNORED) \
181  (A0)(A1)(A2)(A3)(A4)(A5)(A6)(A7)(A8)(A9)(A10)(A11)(A12)(A13)(A14)(A15)(A16)(A17)(A18)(A19)(A20)(A21)(A22)(A23)(A24)
182 #define QI_LIST_BUILD_26(A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15,A16,A17,A18,A19,A20,A21,A22,A23,A24,A25, IGNORED) \
183  (A0)(A1)(A2)(A3)(A4)(A5)(A6)(A7)(A8)(A9)(A10)(A11)(A12)(A13)(A14)(A15)(A16)(A17)(A18)(A19)(A20)(A21)(A22)(A23)(A24)(A25)
184 #define QI_LIST_BUILD_27(A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15,A16,A17,A18,A19,A20,A21,A22,A23,A24,A25,A26, IGNORED) \
185  (A0)(A1)(A2)(A3)(A4)(A5)(A6)(A7)(A8)(A9)(A10)(A11)(A12)(A13)(A14)(A15)(A16)(A17)(A18)(A19)(A20)(A21)(A22)(A23)(A24)(A25)(A26)
186 #define QI_LIST_BUILD_28(A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15,A16,A17,A18,A19,A20,A21,A22,A23,A24,A25,A26,A27, IGNORED) \
187  (A0)(A1)(A2)(A3)(A4)(A5)(A6)(A7)(A8)(A9)(A10)(A11)(A12)(A13)(A14)(A15)(A16)(A17)(A18)(A19)(A20)(A21)(A22)(A23)(A24)(A25)(A26)(A27)
188 #define QI_LIST_BUILD_29(A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15,A16,A17,A18,A19,A20,A21,A22,A23,A24,A25,A26,A27,A28, IGNORED) \
189  (A0)(A1)(A2)(A3)(A4)(A5)(A6)(A7)(A8)(A9)(A10)(A11)(A12)(A13)(A14)(A15)(A16)(A17)(A18)(A19)(A20)(A21)(A22)(A23)(A24)(A25)(A26)(A27)(A28)
190 #define QI_LIST_BUILD_30(A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15,A16,A17,A18,A19,A20,A21,A22,A23,A24,A25,A26,A27,A28,A29, IGNORED) \
191  (A0)(A1)(A2)(A3)(A4)(A5)(A6)(A7)(A8)(A9)(A10)(A11)(A12)(A13)(A14)(A15)(A16)(A17)(A18)(A19)(A20)(A21)(A22)(A23)(A24)(A25)(A26)(A27)(A28)(A29)
192 #define QI_LIST_BUILD_31(A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15,A16,A17,A18,A19,A20,A21,A22,A23,A24,A25,A26,A27,A28,A29,A30, IGNORED) \
193  (A0)(A1)(A2)(A3)(A4)(A5)(A6)(A7)(A8)(A9)(A10)(A11)(A12)(A13)(A14)(A15)(A16)(A17)(A18)(A19)(A20)(A21)(A22)(A23)(A24)(A25)(A26)(A27)(A28)(A29)(A30)
194 
195 # ifdef _MSC_VER
196 # define QI_LIST_VASIZE_HELPER1(...) \
197  QI_DELAY(QI_LIST_VASIZE_HELPER)##2(__VA_ARGS__, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)
198 # else
199 # define QI_LIST_VASIZE_HELPER1(...) \
200  QI_LIST_VASIZE_HELPER2(__VA_ARGS__, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)
201 # endif
202 # define QI_LIST_VASIZE_HELPER2(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22, A23, A24, A25, A26, A27, A28, A29, A30, A31, A32, ...) \
203  A32
204 
205 # define QI_LIST_VASIZE(List) \
206  QI_LIST_VASIZE_HELPER1 List
207 
208 #define QI_LIST_HELPER(M, A) M A
209 
210 #define QI_LIST(...) \
211  QI_LIST_HELPER( \
212  QI_CAT(QI_LIST_BUILD_, QI_LIST_VASIZE((__VA_ARGS__))), \
213  (__VA_ARGS__))
214 
215 # define QI_LIST_SIZE(List) BOOST_PP_SEQ_SIZE(List)
216 
217 # define QI_LIST_EMPTY_0 QI_TRUE
218 # define QI_LIST_EMPTY_1 QI_FALSE
219 # define QI_LIST_EMPTY_2 QI_FALSE
220 # define QI_LIST_EMPTY_3 QI_FALSE
221 # define QI_LIST_EMPTY_4 QI_FALSE
222 # define QI_LIST_EMPTY_5 QI_FALSE
223 # define QI_LIST_EMPTY_6 QI_FALSE
224 # define QI_LIST_EMPTY_7 QI_FALSE
225 # define QI_LIST_EMPTY_8 QI_FALSE
226 # define QI_LIST_EMPTY_9 QI_FALSE
227 # define QI_LIST_EMPTY_10 QI_FALSE
228 # define QI_LIST_EMPTY_11 QI_FALSE
229 # define QI_LIST_EMPTY_12 QI_FALSE
230 # define QI_LIST_EMPTY_13 QI_FALSE
231 # define QI_LIST_EMPTY_14 QI_FALSE
232 # define QI_LIST_EMPTY_15 QI_FALSE
233 # define QI_LIST_EMPTY_16 QI_FALSE
234 # define QI_LIST_EMPTY_17 QI_FALSE
235 # define QI_LIST_EMPTY_18 QI_FALSE
236 # define QI_LIST_EMPTY_19 QI_FALSE
237 # define QI_LIST_EMPTY_20 QI_FALSE
238 # define QI_LIST_EMPTY_21 QI_FALSE
239 # define QI_LIST_EMPTY_22 QI_FALSE
240 # define QI_LIST_EMPTY_23 QI_FALSE
241 # define QI_LIST_EMPTY_24 QI_FALSE
242 # define QI_LIST_EMPTY_25 QI_FALSE
243 # define QI_LIST_EMPTY_26 QI_FALSE
244 # define QI_LIST_EMPTY_27 QI_FALSE
245 # define QI_LIST_EMPTY_28 QI_FALSE
246 # define QI_LIST_EMPTY_29 QI_FALSE
247 # define QI_LIST_EMPTY_30 QI_FALSE
248 # define QI_LIST_EMPTY_31 QI_FALSE
249 # define QI_LIST_EMPTY(List) QI_CAT(QI_LIST_EMPTY_, QI_LIST_SIZE(List))
250 
251 # define QI_LIST_HEAD(List) BOOST_PP_SEQ_HEAD(List)
252 
253 # define QI_LIST_TAIL(List) BOOST_PP_SEQ_TAIL(List)
254 
255 # define QI_LIST_MAP_HELPER(Unused, Macro, Elt) \
256  Macro(Elt)
257 # define QI_LIST_MAP(Macro, List) \
258  BOOST_PP_SEQ_TRANSFORM(QI_LIST_MAP_HELPER, Macro, List)
259 
260 # define QI_LIST_MAP_AUX_HELPER(Unused, Aux, Elt) \
261  BOOST_PP_TUPLE_ELEM(2, 0, Aux)(Elt, BOOST_PP_TUPLE_ELEM(2, 1, Aux))
262 # define QI_LIST_MAP_AUX(Macro, List, Aux) \
263  BOOST_PP_SEQ_TRANSFORM(QI_LIST_MAP_AUX_HELPER, (Macro, Aux), List)
264 
265 # define QI_LIST_APPLY_HELPER(Unused, Macro, Elt) \
266  Macro(Elt)
267 # define QI_LIST_APPLY(Macro, List) \
268  BOOST_PP_SEQ_FOR_EACH(QI_LIST_APPLY_HELPER, Macro, List)
269 
270 # define QI_LIST_APPLY_ARGS_HELPER(Unused, Macro, Elt) \
271  Macro Elt
272 # define QI_LIST_APPLY_ARGS(Macro, List) \
273  BOOST_PP_SEQ_FOR_EACH(QI_LIST_APPLY_ARGS_HELPER, Macro, List)
274 
275 # define QI_LIST_APPLY_AUX_HELPER(Unused, Aux, Elt) \
276  BOOST_PP_TUPLE_ELEM(2, 0, Aux)(Elt, BOOST_PP_TUPLE_ELEM(2, 1, Aux))
277 # define QI_LIST_APPLY_AUX(Macro, List, Aux) \
278  BOOST_PP_SEQ_FOR_EACH(QI_LIST_APPLY_AUX_HELPER, (Macro, Aux), List)
279 
280 /*
281 #!/usr/bin/python
282 
283 def gen(n):
284  args = {'n': n, 'n_1': n - 1,}
285  print '# define QI_LIST_NTH_%(n)s(List) BOOST_PP_CAT(QI_LIST_NTH_%(n)s_, QI_LIST_EMPTY(List))(List)' % args
286  print '# define QI_LIST_NTH_%(n)s_QI_TRUE(List)' % args
287  if n != 0:
288  print '# define QI_LIST_NTH_%(n)s_QI_FALSE(List) QI_LIST_NTH_%(n_1)s(QI_LIST_TAIL(List))' %args
289 
290 for i in range(0, 10):
291  gen(i)
292 */
293 
294 # define QI_LIST_NTH_0(List) BOOST_PP_CAT(QI_LIST_NTH_0_, QI_LIST_EMPTY(List))(List)
295 # define QI_LIST_NTH_0_QI_TRUE(List)
296 # define QI_LIST_NTH_1(List) BOOST_PP_CAT(QI_LIST_NTH_1_, QI_LIST_EMPTY(List))(List)
297 # define QI_LIST_NTH_1_QI_TRUE(List)
298 # define QI_LIST_NTH_1_QI_FALSE(List) QI_LIST_NTH_0(QI_LIST_TAIL(List))
299 # define QI_LIST_NTH_2(List) BOOST_PP_CAT(QI_LIST_NTH_2_, QI_LIST_EMPTY(List))(List)
300 # define QI_LIST_NTH_2_QI_TRUE(List)
301 # define QI_LIST_NTH_2_QI_FALSE(List) QI_LIST_NTH_1(QI_LIST_TAIL(List))
302 # define QI_LIST_NTH_3(List) BOOST_PP_CAT(QI_LIST_NTH_3_, QI_LIST_EMPTY(List))(List)
303 # define QI_LIST_NTH_3_QI_TRUE(List)
304 # define QI_LIST_NTH_3_QI_FALSE(List) QI_LIST_NTH_2(QI_LIST_TAIL(List))
305 # define QI_LIST_NTH_4(List) BOOST_PP_CAT(QI_LIST_NTH_4_, QI_LIST_EMPTY(List))(List)
306 # define QI_LIST_NTH_4_QI_TRUE(List)
307 # define QI_LIST_NTH_4_QI_FALSE(List) QI_LIST_NTH_3(QI_LIST_TAIL(List))
308 # define QI_LIST_NTH_5(List) BOOST_PP_CAT(QI_LIST_NTH_5_, QI_LIST_EMPTY(List))(List)
309 # define QI_LIST_NTH_5_QI_TRUE(List)
310 # define QI_LIST_NTH_5_QI_FALSE(List) QI_LIST_NTH_4(QI_LIST_TAIL(List))
311 # define QI_LIST_NTH_6(List) BOOST_PP_CAT(QI_LIST_NTH_6_, QI_LIST_EMPTY(List))(List)
312 # define QI_LIST_NTH_6_QI_TRUE(List)
313 # define QI_LIST_NTH_6_QI_FALSE(List) QI_LIST_NTH_5(QI_LIST_TAIL(List))
314 # define QI_LIST_NTH_7(List) BOOST_PP_CAT(QI_LIST_NTH_7_, QI_LIST_EMPTY(List))(List)
315 # define QI_LIST_NTH_7_QI_TRUE(List)
316 # define QI_LIST_NTH_7_QI_FALSE(List) QI_LIST_NTH_6(QI_LIST_TAIL(List))
317 # define QI_LIST_NTH_8(List) BOOST_PP_CAT(QI_LIST_NTH_8_, QI_LIST_EMPTY(List))(List)
318 # define QI_LIST_NTH_8_QI_TRUE(List)
319 # define QI_LIST_NTH_8_QI_FALSE(List) QI_LIST_NTH_7(QI_LIST_TAIL(List))
320 # define QI_LIST_NTH_9(List) BOOST_PP_CAT(QI_LIST_NTH_9_, QI_LIST_EMPTY(List))(List)
321 # define QI_LIST_NTH_9_QI_TRUE(List)
322 # define QI_LIST_NTH_9_QI_FALSE(List) QI_LIST_NTH_8(QI_LIST_TAIL(List))
323 # define QI_LIST_NTH_10(List) BOOST_PP_CAT(QI_LIST_NTH_10_, QI_LIST_EMPTY(List))(List)
324 # define QI_LIST_NTH_10_QI_TRUE(List)
325 # define QI_LIST_NTH_10_QI_FALSE(List) QI_LIST_NTH_9(QI_LIST_TAIL(List))
326 # define QI_LIST_NTH_11(List) BOOST_PP_CAT(QI_LIST_NTH_11_, QI_LIST_EMPTY(List))(List)
327 # define QI_LIST_NTH_11_QI_TRUE(List)
328 # define QI_LIST_NTH_11_QI_FALSE(List) QI_LIST_NTH_10(QI_LIST_TAIL(List))
329 # define QI_LIST_NTH_12(List) BOOST_PP_CAT(QI_LIST_NTH_12_, QI_LIST_EMPTY(List))(List)
330 # define QI_LIST_NTH_12_QI_TRUE(List)
331 # define QI_LIST_NTH_12_QI_FALSE(List) QI_LIST_NTH_11(QI_LIST_TAIL(List))
332 # define QI_LIST_NTH_13(List) BOOST_PP_CAT(QI_LIST_NTH_13_, QI_LIST_EMPTY(List))(List)
333 # define QI_LIST_NTH_13_QI_TRUE(List)
334 # define QI_LIST_NTH_13_QI_FALSE(List) QI_LIST_NTH_12(QI_LIST_TAIL(List))
335 # define QI_LIST_NTH_14(List) BOOST_PP_CAT(QI_LIST_NTH_14_, QI_LIST_EMPTY(List))(List)
336 # define QI_LIST_NTH_14_QI_TRUE(List)
337 # define QI_LIST_NTH_14_QI_FALSE(List) QI_LIST_NTH_13(QI_LIST_TAIL(List))
338 # define QI_LIST_NTH_15(List) BOOST_PP_CAT(QI_LIST_NTH_15_, QI_LIST_EMPTY(List))(List)
339 # define QI_LIST_NTH_15_QI_TRUE(List)
340 # define QI_LIST_NTH_15_QI_FALSE(List) QI_LIST_NTH_14(QI_LIST_TAIL(List))
341 # define QI_LIST_NTH_16(List) BOOST_PP_CAT(QI_LIST_NTH_16_, QI_LIST_EMPTY(List))(List)
342 # define QI_LIST_NTH_16_QI_TRUE(List)
343 # define QI_LIST_NTH_16_QI_FALSE(List) QI_LIST_NTH_15(QI_LIST_TAIL(List))
344 # define QI_LIST_NTH_17(List) BOOST_PP_CAT(QI_LIST_NTH_17_, QI_LIST_EMPTY(List))(List)
345 # define QI_LIST_NTH_17_QI_TRUE(List)
346 # define QI_LIST_NTH_17_QI_FALSE(List) QI_LIST_NTH_16(QI_LIST_TAIL(List))
347 # define QI_LIST_NTH_18(List) BOOST_PP_CAT(QI_LIST_NTH_18_, QI_LIST_EMPTY(List))(List)
348 # define QI_LIST_NTH_18_QI_TRUE(List)
349 # define QI_LIST_NTH_18_QI_FALSE(List) QI_LIST_NTH_17(QI_LIST_TAIL(List))
350 # define QI_LIST_NTH_19(List) BOOST_PP_CAT(QI_LIST_NTH_19_, QI_LIST_EMPTY(List))(List)
351 # define QI_LIST_NTH_19_QI_TRUE(List)
352 # define QI_LIST_NTH_19_QI_FALSE(List) QI_LIST_NTH_18(QI_LIST_TAIL(List))
353 # define QI_LIST_NTH_20(List) BOOST_PP_CAT(QI_LIST_NTH_20_, QI_LIST_EMPTY(List))(List)
354 # define QI_LIST_NTH_20_QI_TRUE(List)
355 # define QI_LIST_NTH_20_QI_FALSE(List) QI_LIST_NTH_19(QI_LIST_TAIL(List))
356 # define QI_LIST_NTH_21(List) BOOST_PP_CAT(QI_LIST_NTH_21_, QI_LIST_EMPTY(List))(List)
357 # define QI_LIST_NTH_21_QI_TRUE(List)
358 # define QI_LIST_NTH_21_QI_FALSE(List) QI_LIST_NTH_20(QI_LIST_TAIL(List))
359 # define QI_LIST_NTH_22(List) BOOST_PP_CAT(QI_LIST_NTH_22_, QI_LIST_EMPTY(List))(List)
360 # define QI_LIST_NTH_22_QI_TRUE(List)
361 # define QI_LIST_NTH_22_QI_FALSE(List) QI_LIST_NTH_21(QI_LIST_TAIL(List))
362 # define QI_LIST_NTH_23(List) BOOST_PP_CAT(QI_LIST_NTH_23_, QI_LIST_EMPTY(List))(List)
363 # define QI_LIST_NTH_23_QI_TRUE(List)
364 # define QI_LIST_NTH_23_QI_FALSE(List) QI_LIST_NTH_22(QI_LIST_TAIL(List))
365 # define QI_LIST_NTH_24(List) BOOST_PP_CAT(QI_LIST_NTH_24_, QI_LIST_EMPTY(List))(List)
366 # define QI_LIST_NTH_24_QI_TRUE(List)
367 # define QI_LIST_NTH_24_QI_FALSE(List) QI_LIST_NTH_23(QI_LIST_TAIL(List))
368 # define QI_LIST_NTH_25(List) BOOST_PP_CAT(QI_LIST_NTH_25_, QI_LIST_EMPTY(List))(List)
369 # define QI_LIST_NTH_25_QI_TRUE(List)
370 # define QI_LIST_NTH_25_QI_FALSE(List) QI_LIST_NTH_24(QI_LIST_TAIL(List))
371 # define QI_LIST_NTH_26(List) BOOST_PP_CAT(QI_LIST_NTH_26_, QI_LIST_EMPTY(List))(List)
372 # define QI_LIST_NTH_26_QI_TRUE(List)
373 # define QI_LIST_NTH_26_QI_FALSE(List) QI_LIST_NTH_25(QI_LIST_TAIL(List))
374 # define QI_LIST_NTH_27(List) BOOST_PP_CAT(QI_LIST_NTH_27_, QI_LIST_EMPTY(List))(List)
375 # define QI_LIST_NTH_27_QI_TRUE(List)
376 # define QI_LIST_NTH_27_QI_FALSE(List) QI_LIST_NTH_26(QI_LIST_TAIL(List))
377 # define QI_LIST_NTH_28(List) BOOST_PP_CAT(QI_LIST_NTH_28_, QI_LIST_EMPTY(List))(List)
378 # define QI_LIST_NTH_28_QI_TRUE(List)
379 # define QI_LIST_NTH_28_QI_FALSE(List) QI_LIST_NTH_27(QI_LIST_TAIL(List))
380 # define QI_LIST_NTH_29(List) BOOST_PP_CAT(QI_LIST_NTH_29_, QI_LIST_EMPTY(List))(List)
381 # define QI_LIST_NTH_29_QI_TRUE(List)
382 # define QI_LIST_NTH_29_QI_FALSE(List) QI_LIST_NTH_28(QI_LIST_TAIL(List))
383 # define QI_LIST_NTH_30(List) BOOST_PP_CAT(QI_LIST_NTH_30_, QI_LIST_EMPTY(List))(List)
384 # define QI_LIST_NTH_30_QI_TRUE(List)
385 # define QI_LIST_NTH_30_QI_FALSE(List) QI_LIST_NTH_29(QI_LIST_TAIL(List))
386 # define QI_LIST_NTH_31(List) BOOST_PP_CAT(QI_LIST_NTH_31_, QI_LIST_EMPTY(List))(List)
387 # define QI_LIST_NTH_31_QI_TRUE(List)
388 # define QI_LIST_NTH_31_QI_FALSE(List) QI_LIST_NTH_30(QI_LIST_TAIL(List))
389 
390 # define QI_LIST_NTH_0_QI_FALSE(List) QI_LIST_HEAD(List)
391 # define QI_LIST_NTH(Nth, List) BOOST_PP_CAT(QI_LIST_NTH_, Nth)(List)
392 
393 # define QI_LIST_FLATTEN(List) QI_LIST_SEP(List, )
394 
395 # define QI_LIST_SEP_HELPER(Elt, Sep) \
396  QI_UNWRAP(Sep) Elt
397 # define QI_LIST_SEP_QI_FALSE(List, Sep) \
398  QI_LIST_HEAD(List) \
399  QI_LIST_APPLY_AUX(QI_LIST_SEP_HELPER, QI_LIST_TAIL(List), Sep)
400 # define QI_LIST_SEP_QI_TRUE(List, Sep)
401 # define QI_LIST_SEP(List, Sep) \
402  QI_CAT(QI_LIST_SEP_, \
403  QI_LIST_EMPTY(List))(List, QI_WRAP(Sep))
404 
405 # define QI_LIST_ARG_HELPER(Macro, Args) \
406  Macro Args
407 # define QI_LIST_ARG(Macro, List) \
408  QI_LIST_ARG_HELPER(Macro, (QI_LIST_SEP(List, QI_COMMA)))
409 
411 #define QI_VAARGS_APPLY(Macro, Arg, ...) \
412  BOOST_PP_SEQ_FOR_EACH(Macro, Arg, \
413  QI_LIST(__VA_ARGS__,))
414 
415 #define _QI_OR_00 0
416 #define _QI_OR_01 1
417 #define _QI_OR_10 1
418 #define _QI_OR_11 1
419 #define _QI_OR_I1(a, b) BOOST_PP_CAT(BOOST_PP_CAT(_QI_OR_, a), b)
420 #define _QI_OR_I2(a, b) _QI_OR_I1(a, b)
421 #define _QI_OR_I3(a, b) _QI_OR_I2(a, b)
422 #define _QI_OR_I4(a, b) _QI_OR_I3(a, b)
423 #define QI_OR(a, b) _QI_OR_I4(a, b)
424 
425 #define _QI_IS_EMPTY_HELPER__ a,b
426 #define _QI_IS_ONE_HELPER__1 a,b
427 
428 // To suppress a VCXX warning, the two macro below must be called with CAT(_, arg)
429 // otherwise due to evaluation ordering, code ends up calling QI_IS_ONE() which
430 // triggers a warning
431 
432 //@return 1 if a is defined to 1, 0 otherwise. Must be called with CAT(_, a)
433 #define _QI_IS_ONE(a) QI_LIST_VASIZE((BOOST_PP_CAT(_QI_IS_ONE_HELPER_, a)))
434 //@return 1 if a is defined to empty, 0 otherwise. Must be called with CAT(_, a)
435 #define _QI_IS_EMPTY(a) QI_LIST_VASIZE((BOOST_PP_CAT(_QI_IS_EMPTY_HELPER, BOOST_PP_CAT(_, a))))
436 
437 
438 //@return 1 if a is defined to empty or 1. Return 0 otherwise. Must be called with CAT(_, a)
439 #define _QI_IS_ONE_OR_EMPTY(a) \
440  QI_OR(_QI_IS_EMPTY(a), _QI_IS_ONE(a))
441 
442 
443 #define _QI_GEN_ARGTYPE(z,n,_) BOOST_PP_COMMA_IF(n) P ## n
444 #define _QI_GEN_ARGDECL(z,n,_) BOOST_PP_COMMA_IF(n) P ## n p##n
445 #define _QI_GEN_ARGDECLSAMETYPE(z,n,t) BOOST_PP_COMMA_IF(n) t p##n
446 #define _QI_GEN_ARGUSE(z,n,_) BOOST_PP_COMMA_IF(n) p##n
447 #define _QI_GEN_ARGTYPEDECL(z, n, _) BOOST_PP_COMMA_IF(n) typename P##n
448 
449 #define _QI_GEN_PREPOST(z, n, prepost) BOOST_PP_CAT(BOOST_PP_SEQ_ELEM(0, prepost), n) BOOST_PP_SEQ_ELEM(1, prepost)
450 #define _QI_GEN_PREPOST2(z, n, prepost) BOOST_PP_CAT(BOOST_PP_SEQ_ELEM(0, prepost), n) BOOST_PP_CAT(BOOST_PP_SEQ_ELEM(1, prepost), n) BOOST_PP_SEQ_ELEM(2, prepost)
451 
452 // pre 0 post pre 1 post pre 2 post...
453 #define QI_GEN_PREPOST(n, pre, post) BOOST_PP_REPEAT(n, _QI_GEN_PREPOST, (pre)(post))
454 // pre 0 mid 0 post pre 1 mid 1 post ...
455 #define QI_GEN_PREPOST2(n, pre, mid, post) BOOST_PP_REPEAT(n, _QI_GEN_PREPOST2, (pre)(mid)(post))
456 // P0, P1, ...
457 #define QI_GEN_ARGSTYPE(n) BOOST_PP_REPEAT(n, _QI_GEN_ARGTYPE, _)
458 // P0 p0, P1 p1, ...
459 #define QI_GEN_ARGSDECL(n) BOOST_PP_REPEAT(n, _QI_GEN_ARGDECL, _)
460 // p0, p1, p2 ...
461 #define QI_GEN_ARGSUSE(n) BOOST_PP_REPEAT(n, _QI_GEN_ARGUSE, _)
462 // typename P0, typename P1...
463 #define QI_GEN_ARGSTYPEDECL(n) BOOST_PP_REPEAT(n, _QI_GEN_ARGTYPEDECL, _)
464 // t p0, t p1...
465 #define QI_GEN_ARGSDECLSAMETYPE(n, t) BOOST_PP_REPEAT(n, _QI_GEN_ARGDECLSAMETYPE, t)
466 
467 
468 #define _QI_GEN(z, n, f) f(n, QI_GEN_ARGSTYPEDECL(n), QI_GEN_ARGSTYPE(n), QI_GEN_ARGSDECL(n), QI_GEN_ARGSUSE(n), BOOST_PP_COMMA_IF(n))
469 
470 // invoke f(n, argtypedecl, argstype, argsdecl, argsuses, comma_or_empty) for n in [0, 10]
471 #define QI_GEN(f) BOOST_PP_REPEAT(10, _QI_GEN, f)
472 #define QI_GEN_RANGE(f, max) BOOST_PP_REPEAT(max, _QI_GEN, f)
473 
474 // Evaluate to empty or 'template<' depending on wheter args is empty or a comma.
475 #define QI_GEN_MAYBE_TEMPLATE_OPEN(...) \
476  QI_CAT(_QI_GEN_MAYBE_TEMPLATE_OPEN_, QI_LIST_VASIZE((__VA_ARGS__)))
477 #define QI_GEN_MAYBE_TEMPLATE_CLOSE(...) \
478  QI_CAT(_QI_GEN_MAYBE_TEMPLATE_CLOSE_, QI_LIST_VASIZE((__VA_ARGS__)))
479 
480 #define QI_PAIR_FIRST(x) QI_DELAY(_QI_PAIR_FIRST)x
481 #define QI_PAIR_SECOND(x) QI_DELAY(_QI_PAIR_SECOND)x
482 #define _QI_PAIR_FIRST(x, ...) x
483 #define _QI_PAIR_SECOND(x, y) y
484 #define _QI_GEN_MAYBE_TEMPLATE_OPEN_1 template<
485 #define _QI_GEN_MAYBE_TEMPLATE_OPEN_0
486 #define _QI_GEN_MAYBE_TEMPLATE_CLOSE_1 >
487 #define _QI_GEN_MAYBE_TEMPLATE_CLOSE_0
488 // Return i+1 as a symbol
489 #define QI_GEN_SYMINC(i) BOOST_PP_CAT(_QI_GEN_SYMINC_, i)
490 #define _QI_GEN_SYMINC_9 10
491 #define _QI_GEN_SYMINC_8 9
492 #define _QI_GEN_SYMINC_7 8
493 #define _QI_GEN_SYMINC_6 7
494 #define _QI_GEN_SYMINC_5 6
495 #define _QI_GEN_SYMINC_4 5
496 #define _QI_GEN_SYMINC_3 4
497 #define _QI_GEN_SYMINC_2 3
498 #define _QI_GEN_SYMINC_1 2
499 #define _QI_GEN_SYMINC_0 1
500 
501 #define _QI_IF_QI_TRUE(a) a
502 #define _QI_IF_QI_FALSE(a)
503 #define _QI_NIF_QI_TRUE(a)
504 #define _QI_NIF_QI_FALSE(a) a
505 
506 
507 
508 #define QI_01_TO_TRUEFALSE(v) BOOST_PP_CAT(_QI_01_TO_TRUEFALSE_,v)
509 #define _QI_01_TO_TRUEFALSE_0 QI_FALSE
510 #define _QI_01_TO_TRUEFALSE_1 QI_TRUE
511 
512 # ifdef _MSC_VER
513 /* Sometimes when bouncing __VA_ARGS__ around you end up with all args in the same, so use a delay-trick
514 */
515 #define __QI_VAARGS_MAP_0(Macro, Arg, elem, ...) Macro(0, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##1(Macro, Arg, __VA_ARGS__))
516 #define __QI_VAARGS_MAP_1(Macro, Arg, elem, ...) , Macro(1, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##2(Macro, Arg, __VA_ARGS__))
517 #define __QI_VAARGS_MAP_2(Macro, Arg, elem, ...) , Macro(2, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##3(Macro, Arg, __VA_ARGS__))
518 #define __QI_VAARGS_MAP_3(Macro, Arg, elem, ...) , Macro(3, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##4(Macro, Arg, __VA_ARGS__))
519 #define __QI_VAARGS_MAP_4(Macro, Arg, elem, ...) , Macro(4, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##5(Macro, Arg, __VA_ARGS__))
520 #define __QI_VAARGS_MAP_5(Macro, Arg, elem, ...) , Macro(5, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##6(Macro, Arg, __VA_ARGS__))
521 #define __QI_VAARGS_MAP_6(Macro, Arg, elem, ...) , Macro(6, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##7(Macro, Arg, __VA_ARGS__))
522 #define __QI_VAARGS_MAP_7(Macro, Arg, elem, ...) , Macro(7, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##8(Macro, Arg, __VA_ARGS__))
523 #define __QI_VAARGS_MAP_8(Macro, Arg, elem, ...) , Macro(8, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##9(Macro, Arg, __VA_ARGS__))
524 #define __QI_VAARGS_MAP_9(Macro, Arg, elem, ...) , Macro(9, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##10(Macro, Arg, __VA_ARGS__))
525 #define __QI_VAARGS_MAP_10(Macro, Arg, elem, ...) , Macro(10, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##11(Macro, Arg, __VA_ARGS__))
526 #define __QI_VAARGS_MAP_11(Macro, Arg, elem, ...) , Macro(11, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##12(Macro, Arg, __VA_ARGS__))
527 #define __QI_VAARGS_MAP_12(Macro, Arg, elem, ...) , Macro(12, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##13(Macro, Arg, __VA_ARGS__))
528 #define __QI_VAARGS_MAP_13(Macro, Arg, elem, ...) , Macro(13, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##14(Macro, Arg, __VA_ARGS__))
529 #define __QI_VAARGS_MAP_14(Macro, Arg, elem, ...) , Macro(14, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##15(Macro, Arg, __VA_ARGS__))
530 #define __QI_VAARGS_MAP_15(Macro, Arg, elem, ...) , Macro(15, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##16(Macro, Arg, __VA_ARGS__))
531 #define __QI_VAARGS_MAP_16(Macro, Arg, elem, ...) , Macro(16, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##17(Macro, Arg, __VA_ARGS__))
532 #define __QI_VAARGS_MAP_17(Macro, Arg, elem, ...) , Macro(17, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##18(Macro, Arg, __VA_ARGS__))
533 #define __QI_VAARGS_MAP_18(Macro, Arg, elem, ...) , Macro(18, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##19(Macro, Arg, __VA_ARGS__))
534 #define __QI_VAARGS_MAP_19(Macro, Arg, elem, ...) , Macro(19, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##20(Macro, Arg, __VA_ARGS__))
535 #define __QI_VAARGS_MAP_20(Macro, Arg, elem, ...) , Macro(20, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##21(Macro, Arg, __VA_ARGS__))
536 #define __QI_VAARGS_MAP_21(Macro, Arg, elem, ...) , Macro(21, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##22(Macro, Arg, __VA_ARGS__))
537 #define __QI_VAARGS_MAP_22(Macro, Arg, elem, ...) , Macro(22, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##23(Macro, Arg, __VA_ARGS__))
538 #define __QI_VAARGS_MAP_23(Macro, Arg, elem, ...) , Macro(23, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##24(Macro, Arg, __VA_ARGS__))
539 #define __QI_VAARGS_MAP_24(Macro, Arg, elem, ...) , Macro(24, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##25(Macro, Arg, __VA_ARGS__))
540 #define __QI_VAARGS_MAP_25(Macro, Arg, elem, ...) , Macro(25, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##26(Macro, Arg, __VA_ARGS__))
541 #define __QI_VAARGS_MAP_26(Macro, Arg, elem, ...) , Macro(26, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##27(Macro, Arg, __VA_ARGS__))
542 #define __QI_VAARGS_MAP_27(Macro, Arg, elem, ...) , Macro(27, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##28(Macro, Arg, __VA_ARGS__))
543 #define __QI_VAARGS_MAP_28(Macro, Arg, elem, ...) , Macro(28, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##29(Macro, Arg, __VA_ARGS__))
544 #define __QI_VAARGS_MAP_29(Macro, Arg, elem, ...) , Macro(29, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##30(Macro, Arg, __VA_ARGS__))
545 #define __QI_VAARGS_MAP_30(Macro, Arg, elem, ...) , Macro(30, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##31(Macro, Arg, __VA_ARGS__))
546 #define __QI_VAARGS_MAP_31(Macro, Arg, elem, ...) , Macro(31, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##32(Macro, Arg, __VA_ARGS__))
547 #define __QI_VAARGS_MAP_32(Macro, Arg, elem, ...) , Macro(32, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(QI_DELAY(__QI_VAARGS_MAP_)##33(Macro, Arg, __VA_ARGS__))
548 #define __QI_VAARGS_MAP_33(Macro, Arg, elem, ...) , Macro(33, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(TOO_MANY_ARGUMENTS)
549 
550 #define __QI_VAARGS_EMPTY(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, ...) QI_01_TO_TRUEFALSE(p20)
551 
552 // QI_TRUE if __VA_ARGS__ has *no comma*, QI_FALSE else
553 #define QI_VAARGS_EMPTY(...) QI_DELAY(__QI_VAARGS_)##EMPTY(__VA_ARGS__, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0, 0,1,1)
554 // expand to Macro(0, Arg, p0), Macro(1, Arg, p1), ... , Macro(N, Arg, pN)
555 #define QI_VAARGS_MAP(Macro, Arg, ...) \
556  QI_DELAY(__QI_VAARGS_MAP_)##0(Macro, Arg, __VA_ARGS__,)
557 
558 #else
559 
560 #define __QI_VAARGS_MAP_0(Macro, Arg, elem, ...) Macro(0, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_1(Macro, Arg, __VA_ARGS__))
561 #define __QI_VAARGS_MAP_1(Macro, Arg, elem, ...) , Macro(1, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_2(Macro, Arg, __VA_ARGS__))
562 #define __QI_VAARGS_MAP_2(Macro, Arg, elem, ...) , Macro(2, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_3(Macro, Arg, __VA_ARGS__))
563 #define __QI_VAARGS_MAP_3(Macro, Arg, elem, ...) , Macro(3, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_4(Macro, Arg, __VA_ARGS__))
564 #define __QI_VAARGS_MAP_4(Macro, Arg, elem, ...) , Macro(4, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_5(Macro, Arg, __VA_ARGS__))
565 #define __QI_VAARGS_MAP_5(Macro, Arg, elem, ...) , Macro(5, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_6(Macro, Arg, __VA_ARGS__))
566 #define __QI_VAARGS_MAP_6(Macro, Arg, elem, ...) , Macro(6, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_7(Macro, Arg, __VA_ARGS__))
567 #define __QI_VAARGS_MAP_7(Macro, Arg, elem, ...) , Macro(7, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_8(Macro, Arg, __VA_ARGS__))
568 #define __QI_VAARGS_MAP_8(Macro, Arg, elem, ...) , Macro(8, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_9(Macro, Arg, __VA_ARGS__))
569 #define __QI_VAARGS_MAP_9(Macro, Arg, elem, ...) , Macro(9, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_10(Macro, Arg, __VA_ARGS__))
570 #define __QI_VAARGS_MAP_10(Macro, Arg, elem, ...) , Macro(10, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_11(Macro, Arg, __VA_ARGS__))
571 #define __QI_VAARGS_MAP_11(Macro, Arg, elem, ...) , Macro(11, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_12(Macro, Arg, __VA_ARGS__))
572 #define __QI_VAARGS_MAP_12(Macro, Arg, elem, ...) , Macro(12, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_13(Macro, Arg, __VA_ARGS__))
573 #define __QI_VAARGS_MAP_13(Macro, Arg, elem, ...) , Macro(13, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_14(Macro, Arg, __VA_ARGS__))
574 #define __QI_VAARGS_MAP_14(Macro, Arg, elem, ...) , Macro(14, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_15(Macro, Arg, __VA_ARGS__))
575 #define __QI_VAARGS_MAP_15(Macro, Arg, elem, ...) , Macro(15, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_16(Macro, Arg, __VA_ARGS__))
576 #define __QI_VAARGS_MAP_16(Macro, Arg, elem, ...) , Macro(16, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_17(Macro, Arg, __VA_ARGS__))
577 #define __QI_VAARGS_MAP_17(Macro, Arg, elem, ...) , Macro(17, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_18(Macro, Arg, __VA_ARGS__))
578 #define __QI_VAARGS_MAP_18(Macro, Arg, elem, ...) , Macro(18, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_19(Macro, Arg, __VA_ARGS__))
579 #define __QI_VAARGS_MAP_19(Macro, Arg, elem, ...) , Macro(19, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_20(Macro, Arg, __VA_ARGS__))
580 #define __QI_VAARGS_MAP_20(Macro, Arg, elem, ...) , Macro(20, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_21(Macro, Arg, __VA_ARGS__))
581 #define __QI_VAARGS_MAP_21(Macro, Arg, elem, ...) , Macro(21, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_22(Macro, Arg, __VA_ARGS__))
582 #define __QI_VAARGS_MAP_22(Macro, Arg, elem, ...) , Macro(22, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_23(Macro, Arg, __VA_ARGS__))
583 #define __QI_VAARGS_MAP_23(Macro, Arg, elem, ...) , Macro(23, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_24(Macro, Arg, __VA_ARGS__))
584 #define __QI_VAARGS_MAP_24(Macro, Arg, elem, ...) , Macro(24, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_25(Macro, Arg, __VA_ARGS__))
585 #define __QI_VAARGS_MAP_25(Macro, Arg, elem, ...) , Macro(25, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_26(Macro, Arg, __VA_ARGS__))
586 #define __QI_VAARGS_MAP_26(Macro, Arg, elem, ...) , Macro(26, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_27(Macro, Arg, __VA_ARGS__))
587 #define __QI_VAARGS_MAP_27(Macro, Arg, elem, ...) , Macro(27, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_28(Macro, Arg, __VA_ARGS__))
588 #define __QI_VAARGS_MAP_28(Macro, Arg, elem, ...) , Macro(28, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_29(Macro, Arg, __VA_ARGS__))
589 #define __QI_VAARGS_MAP_29(Macro, Arg, elem, ...) , Macro(29, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_30(Macro, Arg, __VA_ARGS__))
590 #define __QI_VAARGS_MAP_30(Macro, Arg, elem, ...) , Macro(30, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_31(Macro, Arg, __VA_ARGS__))
591 #define __QI_VAARGS_MAP_31(Macro, Arg, elem, ...) , Macro(31, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_32(Macro, Arg, __VA_ARGS__))
592 #define __QI_VAARGS_MAP_32(Macro, Arg, elem, ...) , Macro(32, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(__QI_VAARGS_MAP_33(Macro, Arg, __VA_ARGS__))
593 #define __QI_VAARGS_MAP_33(Macro, Arg, elem, ...) , Macro(33, Arg, elem) QI_CAT(_QI_NIF_,QI_VAARGS_EMPTY(__VA_ARGS__))(TOO_MANY_ARGUMENTS)
594 
595 #define __QI_VAARGS_EMPTY(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, ...) QI_01_TO_TRUEFALSE(p20)
596 
598 #define QI_VAARGS_EMPTY(...) __QI_VAARGS_EMPTY(__VA_ARGS__, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0, 0,1,1)
599 #define QI_VAARGS_MAP(Macro, Arg, ...) \
601  __QI_VAARGS_MAP_0(Macro, Arg, __VA_ARGS__,)
602 
603 #endif
604 
605 
606 
607 #endif // _QI_PREPROC_HPP_