34 #include <string_view>
35 #include <type_traits>
41 #ifndef PPUTL_TUPLE_ARGS_H_INCLUDED
42 #define PPUTL_TUPLE_ARGS_H_INCLUDED
50 #// _____ _____ __ __\ \ ,_\//\ \
51 #// /\ '__`\/\ '__`\/\ \/\ \\ \ \/ \ \ \
52 #// \ \ \_\ \ \ \_\ \ \ \_\ \\ \ \_ \_\ \_
53 #// \ \ ,__/\ \ ,__/\ \____/ \ \__\/\____\
54 #// \ \ \ \ \ \ \/___/ \/__/\/____/
57 #// pputl Preprocessor Utilities
58 #// Copyright (C) 2020, 2021 Justin Collier <m@jpcx.dev>
60 #// This program is free software: you can redistribute it and/or modify
61 #// it under the terms of the GNU General Public License as published by
62 #// the Free Software Foundation, either version 3 of the License, or
63 #// (at your option) any later version.
65 #// This program is distributed in the hope that it will be useful,
66 #// but WITHOUT ANY WARRANTY; without even the internalied warranty of
67 #// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
68 #// GNU General Public License for more details.
70 #// You should have received a copy of the GNU General Public License
71 #// along with this program. If not, see <https://www.gnu.org/licenses/>.
82 #define PPUTL_TUPLE_ARGS(tup) PPUTL_TUPLE_ARGS_RETURN tup
84 #define PPUTL_TUPLE_ARGS_RETURN(...) __VA_ARGS__
91 #ifndef PPUTL_NARGS_H_INCLUDED
92 #define PPUTL_NARGS_H_INCLUDED
100 #// _____ _____ __ __\ \ ,_\//\ \
101 #// /\ '__`\/\ '__`\/\ \/\ \\ \ \/ \ \ \
102 #// \ \ \_\ \ \ \_\ \ \ \_\ \\ \ \_ \_\ \_
103 #// \ \ ,__/\ \ ,__/\ \____/ \ \__\/\____\
104 #// \ \ \ \ \ \ \/___/ \/__/\/____/
107 #// pputl Preprocessor Utilities
108 #// Copyright (C) 2020, 2021 Justin Collier <m@jpcx.dev>
110 #// This program is free software: you can redistribute it and/or modify
111 #// it under the terms of the GNU General Public License as published by
112 #// the Free Software Foundation, either version 3 of the License, or
113 #// (at your option) any later version.
115 #// This program is distributed in the hope that it will be useful,
116 #// but WITHOUT ANY WARRANTY; without even the internalied warranty of
117 #// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
118 #// GNU General Public License for more details.
120 #// You should have received a copy of the GNU General Public License
121 #// along with this program. If not, see <https://www.gnu.org/licenses/>.
127 #define PPUTL_NARGS(...) PPUTL_DETAIL_NARGS_X(__VA_ARGS__)
129 #define PPUTL_DETAIL_NARGS_X(...) \
130 PPUTL_DETAIL_NARGS_CHOOSER( \
131 __VA_ARGS__ __VA_OPT__(, ) PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
132 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
133 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
134 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
135 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
136 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
137 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
138 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
139 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
140 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
141 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
142 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
143 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
144 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
145 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
146 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
147 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
148 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
149 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
150 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
151 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
152 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
153 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
154 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
155 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
156 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
157 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
158 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
159 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
160 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
161 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
162 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
163 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
164 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
165 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
166 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
167 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
168 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
169 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
170 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
171 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
172 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
173 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
174 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
175 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
176 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
177 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
178 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
179 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
180 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
181 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
182 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
183 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
184 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
185 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
186 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
187 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
188 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
189 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
190 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
191 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
192 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
193 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
194 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
195 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
196 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
197 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
198 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
199 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
200 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
201 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
202 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
203 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
204 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
205 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
206 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
207 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
208 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
209 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
210 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
211 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
212 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
213 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
214 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
215 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
216 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
217 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
218 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
219 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
220 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
221 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
222 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
223 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
224 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
225 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
226 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
227 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
228 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
229 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
230 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
231 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
232 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
233 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
234 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
235 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
236 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
237 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
238 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
239 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
240 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
241 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
242 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
243 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
244 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
245 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
246 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
247 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
248 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
249 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
250 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
251 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
252 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
253 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
254 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
255 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
256 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
257 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
258 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, PPUTL_DETAIL_NARGS_E_TOOMANYARGS, \
259 PPUTL_DETAIL_NARGS_E_TOOMANYARGS, 255, 254, 253, 252, 251, 250, 249, \
260 248, 247, 246, 245, 244, 243, 242, 241, 240, 239, 238, 237, 236, 235, \
261 234, 233, 232, 231, 230, 229, 228, 227, 226, 225, 224, 223, 222, 221, \
262 220, 219, 218, 217, 216, 215, 214, 213, 212, 211, 210, 209, 208, 207, \
263 206, 205, 204, 203, 202, 201, 200, 199, 198, 197, 196, 195, 194, 193, \
264 192, 191, 190, 189, 188, 187, 186, 185, 184, 183, 182, 181, 180, 179, \
265 178, 177, 176, 175, 174, 173, 172, 171, 170, 169, 168, 167, 166, 165, \
266 164, 163, 162, 161, 160, 159, 158, 157, 156, 155, 154, 153, 152, 151, \
267 150, 149, 148, 147, 146, 145, 144, 143, 142, 141, 140, 139, 138, 137, \
268 136, 135, 134, 133, 132, 131, 130, 129, 128, 127, 126, 125, 124, 123, \
269 122, 121, 120, 119, 118, 117, 116, 115, 114, 113, 112, 111, 110, 109, \
270 108, 107, 106, 105, 104, 103, 102, 101, 100, 99, 98, 97, 96, 95, 94, 93, \
271 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, \
272 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, \
273 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, \
274 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, \
275 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, \
278 #define PPUTL_DETAIL_NARGS_CHOOSER( \
279 e255, e254, e253, e252, e251, e250, e249, e248, e247, e246, e245, e244, \
280 e243, e242, e241, e240, e239, e238, e237, e236, e235, e234, e233, e232, \
281 e231, e230, e229, e228, e227, e226, e225, e224, e223, e222, e221, e220, \
282 e219, e218, e217, e216, e215, e214, e213, e212, e211, e210, e209, e208, \
283 e207, e206, e205, e204, e203, e202, e201, e200, e199, e198, e197, e196, \
284 e195, e194, e193, e192, e191, e190, e189, e188, e187, e186, e185, e184, \
285 e183, e182, e181, e180, e179, e178, e177, e176, e175, e174, e173, e172, \
286 e171, e170, e169, e168, e167, e166, e165, e164, e163, e162, e161, e160, \
287 e159, e158, e157, e156, e155, e154, e153, e152, e151, e150, e149, e148, \
288 e147, e146, e145, e144, e143, e142, e141, e140, e139, e138, e137, e136, \
289 e135, e134, e133, e132, e131, e130, e129, e128, e127, e126, e125, e124, \
290 e123, e122, e121, e120, e119, e118, e117, e116, e115, e114, e113, e112, \
291 e111, e110, e109, e108, e107, e106, e105, e104, e103, e102, e101, e100, \
292 e99, e98, e97, e96, e95, e94, e93, e92, e91, e90, e89, e88, e87, e86, e85, \
293 e84, e83, e82, e81, e80, e79, e78, e77, e76, e75, e74, e73, e72, e71, e70, \
294 e69, e68, e67, e66, e65, e64, e63, e62, e61, e60, e59, e58, e57, e56, e55, \
295 e54, e53, e52, e51, e50, e49, e48, e47, e46, e45, e44, e43, e42, e41, e40, \
296 e39, e38, e37, e36, e35, e34, e33, e32, e31, e30, e29, e28, e27, e26, e25, \
297 e24, e23, e22, e21, e20, e19, e18, e17, e16, e15, e14, e13, e12, e11, e10, \
298 e9, e8, e7, e6, e5, e4, e3, e2, e1, _0, _1, _2, _3, _4, _5, _6, _7, _8, \
299 _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, \
300 _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, \
301 _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, \
302 _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, _65, _66, _67, _68, \
303 _69, _70, _71, _72, _73, _74, _75, _76, _77, _78, _79, _80, _81, _82, _83, \
304 _84, _85, _86, _87, _88, _89, _90, _91, _92, _93, _94, _95, _96, _97, _98, \
305 _99, _100, _101, _102, _103, _104, _105, _106, _107, _108, _109, _110, \
306 _111, _112, _113, _114, _115, _116, _117, _118, _119, _120, _121, _122, \
307 _123, _124, _125, _126, _127, _128, _129, _130, _131, _132, _133, _134, \
308 _135, _136, _137, _138, _139, _140, _141, _142, _143, _144, _145, _146, \
309 _147, _148, _149, _150, _151, _152, _153, _154, _155, _156, _157, _158, \
310 _159, _160, _161, _162, _163, _164, _165, _166, _167, _168, _169, _170, \
311 _171, _172, _173, _174, _175, _176, _177, _178, _179, _180, _181, _182, \
312 _183, _184, _185, _186, _187, _188, _189, _190, _191, _192, _193, _194, \
313 _195, _196, _197, _198, _199, _200, _201, _202, _203, _204, _205, _206, \
314 _207, _208, _209, _210, _211, _212, _213, _214, _215, _216, _217, _218, \
315 _219, _220, _221, _222, _223, _224, _225, _226, _227, _228, _229, _230, \
316 _231, _232, _233, _234, _235, _236, _237, _238, _239, _240, _241, _242, \
317 _243, _244, _245, _246, _247, _248, _249, _250, _251, _252, _253, _254, \
321 #define PPUTL_DETAIL_NARGS_E_TOOMANYARGS \
323 static_assert(false, "PPUTL_NARGS: too many args [0, 256)"); \
332 #ifndef PPUTL_CAT_H_INCLUDED
333 #define PPUTL_CAT_H_INCLUDED
341 #// _____ _____ __ __\ \ ,_\//\ \
342 #// /\ '__`\/\ '__`\/\ \/\ \\ \ \/ \ \ \
343 #// \ \ \_\ \ \ \_\ \ \ \_\ \\ \ \_ \_\ \_
344 #// \ \ ,__/\ \ ,__/\ \____/ \ \__\/\____\
345 #// \ \ \ \ \ \ \/___/ \/__/\/____/
348 #// pputl Preprocessor Utilities
349 #// Copyright (C) 2020, 2021 Justin Collier <m@jpcx.dev>
351 #// This program is free software: you can redistribute it and/or modify
352 #// it under the terms of the GNU General Public License as published by
353 #// the Free Software Foundation, either version 3 of the License, or
354 #// (at your option) any later version.
356 #// This program is distributed in the hope that it will be useful,
357 #// but WITHOUT ANY WARRANTY; without even the internalied warranty of
358 #// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
359 #// GNU General Public License for more details.
361 #// You should have received a copy of the GNU General Public License
362 #// along with this program. If not, see <https://www.gnu.org/licenses/>.
369 #define PPUTL_CAT(...) PPUTL_DETAIL_CAT_X(__VA_ARGS__)
371 #define PPUTL_DETAIL_CAT_X(...) \
372 PPUTL_DETAIL_CAT_CHOOSER(PPUTL_NARGS(__VA_ARGS__)) \
374 #define PPUTL_DETAIL_CAT_CHOOSER(nargs) PPUTL_DETAIL_CAT_CHOOSER_X(nargs)
375 #define PPUTL_DETAIL_CAT_CHOOSER_X(nargs) PPUTL_DETAIL_CAT_##nargs
378 #define PPUTL_DETAIL_CAT_0()
379 #define PPUTL_DETAIL_CAT_1(a) a
380 #define PPUTL_DETAIL_CAT_2(a, b) a##b
381 #define PPUTL_DETAIL_CAT_3(a, b, ...) PPUTL_DETAIL_CAT_2(a##b, __VA_ARGS__)
382 #define PPUTL_DETAIL_CAT_4(a, b, ...) PPUTL_DETAIL_CAT_3(a##b, __VA_ARGS__)
383 #define PPUTL_DETAIL_CAT_5(a, b, ...) PPUTL_DETAIL_CAT_4(a##b, __VA_ARGS__)
384 #define PPUTL_DETAIL_CAT_6(a, b, ...) PPUTL_DETAIL_CAT_5(a##b, __VA_ARGS__)
385 #define PPUTL_DETAIL_CAT_7(a, b, ...) PPUTL_DETAIL_CAT_6(a##b, __VA_ARGS__)
386 #define PPUTL_DETAIL_CAT_8(a, b, ...) PPUTL_DETAIL_CAT_7(a##b, __VA_ARGS__)
387 #define PPUTL_DETAIL_CAT_9(a, b, ...) PPUTL_DETAIL_CAT_8(a##b, __VA_ARGS__)
388 #define PPUTL_DETAIL_CAT_10(a, b, ...) PPUTL_DETAIL_CAT_9(a##b, __VA_ARGS__)
389 #define PPUTL_DETAIL_CAT_11(a, b, ...) PPUTL_DETAIL_CAT_10(a##b, __VA_ARGS__)
390 #define PPUTL_DETAIL_CAT_12(a, b, ...) PPUTL_DETAIL_CAT_11(a##b, __VA_ARGS__)
391 #define PPUTL_DETAIL_CAT_13(a, b, ...) PPUTL_DETAIL_CAT_12(a##b, __VA_ARGS__)
392 #define PPUTL_DETAIL_CAT_14(a, b, ...) PPUTL_DETAIL_CAT_13(a##b, __VA_ARGS__)
393 #define PPUTL_DETAIL_CAT_15(a, b, ...) PPUTL_DETAIL_CAT_14(a##b, __VA_ARGS__)
394 #define PPUTL_DETAIL_CAT_16(a, b, ...) PPUTL_DETAIL_CAT_15(a##b, __VA_ARGS__)
395 #define PPUTL_DETAIL_CAT_17(a, b, ...) PPUTL_DETAIL_CAT_16(a##b, __VA_ARGS__)
396 #define PPUTL_DETAIL_CAT_18(a, b, ...) PPUTL_DETAIL_CAT_17(a##b, __VA_ARGS__)
397 #define PPUTL_DETAIL_CAT_19(a, b, ...) PPUTL_DETAIL_CAT_18(a##b, __VA_ARGS__)
398 #define PPUTL_DETAIL_CAT_20(a, b, ...) PPUTL_DETAIL_CAT_19(a##b, __VA_ARGS__)
399 #define PPUTL_DETAIL_CAT_21(a, b, ...) PPUTL_DETAIL_CAT_20(a##b, __VA_ARGS__)
400 #define PPUTL_DETAIL_CAT_22(a, b, ...) PPUTL_DETAIL_CAT_21(a##b, __VA_ARGS__)
401 #define PPUTL_DETAIL_CAT_23(a, b, ...) PPUTL_DETAIL_CAT_22(a##b, __VA_ARGS__)
402 #define PPUTL_DETAIL_CAT_24(a, b, ...) PPUTL_DETAIL_CAT_23(a##b, __VA_ARGS__)
403 #define PPUTL_DETAIL_CAT_25(a, b, ...) PPUTL_DETAIL_CAT_24(a##b, __VA_ARGS__)
404 #define PPUTL_DETAIL_CAT_26(a, b, ...) PPUTL_DETAIL_CAT_25(a##b, __VA_ARGS__)
405 #define PPUTL_DETAIL_CAT_27(a, b, ...) PPUTL_DETAIL_CAT_26(a##b, __VA_ARGS__)
406 #define PPUTL_DETAIL_CAT_28(a, b, ...) PPUTL_DETAIL_CAT_27(a##b, __VA_ARGS__)
407 #define PPUTL_DETAIL_CAT_29(a, b, ...) PPUTL_DETAIL_CAT_28(a##b, __VA_ARGS__)
408 #define PPUTL_DETAIL_CAT_30(a, b, ...) PPUTL_DETAIL_CAT_29(a##b, __VA_ARGS__)
409 #define PPUTL_DETAIL_CAT_31(a, b, ...) PPUTL_DETAIL_CAT_30(a##b, __VA_ARGS__)
410 #define PPUTL_DETAIL_CAT_32(a, b, ...) PPUTL_DETAIL_CAT_31(a##b, __VA_ARGS__)
411 #define PPUTL_DETAIL_CAT_33(a, b, ...) PPUTL_DETAIL_CAT_32(a##b, __VA_ARGS__)
412 #define PPUTL_DETAIL_CAT_34(a, b, ...) PPUTL_DETAIL_CAT_33(a##b, __VA_ARGS__)
413 #define PPUTL_DETAIL_CAT_35(a, b, ...) PPUTL_DETAIL_CAT_34(a##b, __VA_ARGS__)
414 #define PPUTL_DETAIL_CAT_36(a, b, ...) PPUTL_DETAIL_CAT_35(a##b, __VA_ARGS__)
415 #define PPUTL_DETAIL_CAT_37(a, b, ...) PPUTL_DETAIL_CAT_36(a##b, __VA_ARGS__)
416 #define PPUTL_DETAIL_CAT_38(a, b, ...) PPUTL_DETAIL_CAT_37(a##b, __VA_ARGS__)
417 #define PPUTL_DETAIL_CAT_39(a, b, ...) PPUTL_DETAIL_CAT_38(a##b, __VA_ARGS__)
418 #define PPUTL_DETAIL_CAT_40(a, b, ...) PPUTL_DETAIL_CAT_39(a##b, __VA_ARGS__)
419 #define PPUTL_DETAIL_CAT_41(a, b, ...) PPUTL_DETAIL_CAT_40(a##b, __VA_ARGS__)
420 #define PPUTL_DETAIL_CAT_42(a, b, ...) PPUTL_DETAIL_CAT_41(a##b, __VA_ARGS__)
421 #define PPUTL_DETAIL_CAT_43(a, b, ...) PPUTL_DETAIL_CAT_42(a##b, __VA_ARGS__)
422 #define PPUTL_DETAIL_CAT_44(a, b, ...) PPUTL_DETAIL_CAT_43(a##b, __VA_ARGS__)
423 #define PPUTL_DETAIL_CAT_45(a, b, ...) PPUTL_DETAIL_CAT_44(a##b, __VA_ARGS__)
424 #define PPUTL_DETAIL_CAT_46(a, b, ...) PPUTL_DETAIL_CAT_45(a##b, __VA_ARGS__)
425 #define PPUTL_DETAIL_CAT_47(a, b, ...) PPUTL_DETAIL_CAT_46(a##b, __VA_ARGS__)
426 #define PPUTL_DETAIL_CAT_48(a, b, ...) PPUTL_DETAIL_CAT_47(a##b, __VA_ARGS__)
427 #define PPUTL_DETAIL_CAT_49(a, b, ...) PPUTL_DETAIL_CAT_48(a##b, __VA_ARGS__)
428 #define PPUTL_DETAIL_CAT_50(a, b, ...) PPUTL_DETAIL_CAT_49(a##b, __VA_ARGS__)
429 #define PPUTL_DETAIL_CAT_51(a, b, ...) PPUTL_DETAIL_CAT_50(a##b, __VA_ARGS__)
430 #define PPUTL_DETAIL_CAT_52(a, b, ...) PPUTL_DETAIL_CAT_51(a##b, __VA_ARGS__)
431 #define PPUTL_DETAIL_CAT_53(a, b, ...) PPUTL_DETAIL_CAT_52(a##b, __VA_ARGS__)
432 #define PPUTL_DETAIL_CAT_54(a, b, ...) PPUTL_DETAIL_CAT_53(a##b, __VA_ARGS__)
433 #define PPUTL_DETAIL_CAT_55(a, b, ...) PPUTL_DETAIL_CAT_54(a##b, __VA_ARGS__)
434 #define PPUTL_DETAIL_CAT_56(a, b, ...) PPUTL_DETAIL_CAT_55(a##b, __VA_ARGS__)
435 #define PPUTL_DETAIL_CAT_57(a, b, ...) PPUTL_DETAIL_CAT_56(a##b, __VA_ARGS__)
436 #define PPUTL_DETAIL_CAT_58(a, b, ...) PPUTL_DETAIL_CAT_57(a##b, __VA_ARGS__)
437 #define PPUTL_DETAIL_CAT_59(a, b, ...) PPUTL_DETAIL_CAT_58(a##b, __VA_ARGS__)
438 #define PPUTL_DETAIL_CAT_60(a, b, ...) PPUTL_DETAIL_CAT_59(a##b, __VA_ARGS__)
439 #define PPUTL_DETAIL_CAT_61(a, b, ...) PPUTL_DETAIL_CAT_60(a##b, __VA_ARGS__)
440 #define PPUTL_DETAIL_CAT_62(a, b, ...) PPUTL_DETAIL_CAT_61(a##b, __VA_ARGS__)
441 #define PPUTL_DETAIL_CAT_63(a, b, ...) PPUTL_DETAIL_CAT_62(a##b, __VA_ARGS__)
442 #define PPUTL_DETAIL_CAT_64(a, b, ...) PPUTL_DETAIL_CAT_63(a##b, __VA_ARGS__)
443 #define PPUTL_DETAIL_CAT_65(a, b, ...) PPUTL_DETAIL_CAT_64(a##b, __VA_ARGS__)
444 #define PPUTL_DETAIL_CAT_66(a, b, ...) PPUTL_DETAIL_CAT_65(a##b, __VA_ARGS__)
445 #define PPUTL_DETAIL_CAT_67(a, b, ...) PPUTL_DETAIL_CAT_66(a##b, __VA_ARGS__)
446 #define PPUTL_DETAIL_CAT_68(a, b, ...) PPUTL_DETAIL_CAT_67(a##b, __VA_ARGS__)
447 #define PPUTL_DETAIL_CAT_69(a, b, ...) PPUTL_DETAIL_CAT_68(a##b, __VA_ARGS__)
448 #define PPUTL_DETAIL_CAT_70(a, b, ...) PPUTL_DETAIL_CAT_69(a##b, __VA_ARGS__)
449 #define PPUTL_DETAIL_CAT_71(a, b, ...) PPUTL_DETAIL_CAT_70(a##b, __VA_ARGS__)
450 #define PPUTL_DETAIL_CAT_72(a, b, ...) PPUTL_DETAIL_CAT_71(a##b, __VA_ARGS__)
451 #define PPUTL_DETAIL_CAT_73(a, b, ...) PPUTL_DETAIL_CAT_72(a##b, __VA_ARGS__)
452 #define PPUTL_DETAIL_CAT_74(a, b, ...) PPUTL_DETAIL_CAT_73(a##b, __VA_ARGS__)
453 #define PPUTL_DETAIL_CAT_75(a, b, ...) PPUTL_DETAIL_CAT_74(a##b, __VA_ARGS__)
454 #define PPUTL_DETAIL_CAT_76(a, b, ...) PPUTL_DETAIL_CAT_75(a##b, __VA_ARGS__)
455 #define PPUTL_DETAIL_CAT_77(a, b, ...) PPUTL_DETAIL_CAT_76(a##b, __VA_ARGS__)
456 #define PPUTL_DETAIL_CAT_78(a, b, ...) PPUTL_DETAIL_CAT_77(a##b, __VA_ARGS__)
457 #define PPUTL_DETAIL_CAT_79(a, b, ...) PPUTL_DETAIL_CAT_78(a##b, __VA_ARGS__)
458 #define PPUTL_DETAIL_CAT_80(a, b, ...) PPUTL_DETAIL_CAT_79(a##b, __VA_ARGS__)
459 #define PPUTL_DETAIL_CAT_81(a, b, ...) PPUTL_DETAIL_CAT_80(a##b, __VA_ARGS__)
460 #define PPUTL_DETAIL_CAT_82(a, b, ...) PPUTL_DETAIL_CAT_81(a##b, __VA_ARGS__)
461 #define PPUTL_DETAIL_CAT_83(a, b, ...) PPUTL_DETAIL_CAT_82(a##b, __VA_ARGS__)
462 #define PPUTL_DETAIL_CAT_84(a, b, ...) PPUTL_DETAIL_CAT_83(a##b, __VA_ARGS__)
463 #define PPUTL_DETAIL_CAT_85(a, b, ...) PPUTL_DETAIL_CAT_84(a##b, __VA_ARGS__)
464 #define PPUTL_DETAIL_CAT_86(a, b, ...) PPUTL_DETAIL_CAT_85(a##b, __VA_ARGS__)
465 #define PPUTL_DETAIL_CAT_87(a, b, ...) PPUTL_DETAIL_CAT_86(a##b, __VA_ARGS__)
466 #define PPUTL_DETAIL_CAT_88(a, b, ...) PPUTL_DETAIL_CAT_87(a##b, __VA_ARGS__)
467 #define PPUTL_DETAIL_CAT_89(a, b, ...) PPUTL_DETAIL_CAT_88(a##b, __VA_ARGS__)
468 #define PPUTL_DETAIL_CAT_90(a, b, ...) PPUTL_DETAIL_CAT_89(a##b, __VA_ARGS__)
469 #define PPUTL_DETAIL_CAT_91(a, b, ...) PPUTL_DETAIL_CAT_90(a##b, __VA_ARGS__)
470 #define PPUTL_DETAIL_CAT_92(a, b, ...) PPUTL_DETAIL_CAT_91(a##b, __VA_ARGS__)
471 #define PPUTL_DETAIL_CAT_93(a, b, ...) PPUTL_DETAIL_CAT_92(a##b, __VA_ARGS__)
472 #define PPUTL_DETAIL_CAT_94(a, b, ...) PPUTL_DETAIL_CAT_93(a##b, __VA_ARGS__)
473 #define PPUTL_DETAIL_CAT_95(a, b, ...) PPUTL_DETAIL_CAT_94(a##b, __VA_ARGS__)
474 #define PPUTL_DETAIL_CAT_96(a, b, ...) PPUTL_DETAIL_CAT_95(a##b, __VA_ARGS__)
475 #define PPUTL_DETAIL_CAT_97(a, b, ...) PPUTL_DETAIL_CAT_96(a##b, __VA_ARGS__)
476 #define PPUTL_DETAIL_CAT_98(a, b, ...) PPUTL_DETAIL_CAT_97(a##b, __VA_ARGS__)
477 #define PPUTL_DETAIL_CAT_99(a, b, ...) PPUTL_DETAIL_CAT_98(a##b, __VA_ARGS__)
478 #define PPUTL_DETAIL_CAT_100(a, b, ...) PPUTL_DETAIL_CAT_99(a##b, __VA_ARGS__)
479 #define PPUTL_DETAIL_CAT_101(a, b, ...) PPUTL_DETAIL_CAT_100(a##b, __VA_ARGS__)
480 #define PPUTL_DETAIL_CAT_102(a, b, ...) PPUTL_DETAIL_CAT_101(a##b, __VA_ARGS__)
481 #define PPUTL_DETAIL_CAT_103(a, b, ...) PPUTL_DETAIL_CAT_102(a##b, __VA_ARGS__)
482 #define PPUTL_DETAIL_CAT_104(a, b, ...) PPUTL_DETAIL_CAT_103(a##b, __VA_ARGS__)
483 #define PPUTL_DETAIL_CAT_105(a, b, ...) PPUTL_DETAIL_CAT_104(a##b, __VA_ARGS__)
484 #define PPUTL_DETAIL_CAT_106(a, b, ...) PPUTL_DETAIL_CAT_105(a##b, __VA_ARGS__)
485 #define PPUTL_DETAIL_CAT_107(a, b, ...) PPUTL_DETAIL_CAT_106(a##b, __VA_ARGS__)
486 #define PPUTL_DETAIL_CAT_108(a, b, ...) PPUTL_DETAIL_CAT_107(a##b, __VA_ARGS__)
487 #define PPUTL_DETAIL_CAT_109(a, b, ...) PPUTL_DETAIL_CAT_108(a##b, __VA_ARGS__)
488 #define PPUTL_DETAIL_CAT_110(a, b, ...) PPUTL_DETAIL_CAT_109(a##b, __VA_ARGS__)
489 #define PPUTL_DETAIL_CAT_111(a, b, ...) PPUTL_DETAIL_CAT_110(a##b, __VA_ARGS__)
490 #define PPUTL_DETAIL_CAT_112(a, b, ...) PPUTL_DETAIL_CAT_111(a##b, __VA_ARGS__)
491 #define PPUTL_DETAIL_CAT_113(a, b, ...) PPUTL_DETAIL_CAT_112(a##b, __VA_ARGS__)
492 #define PPUTL_DETAIL_CAT_114(a, b, ...) PPUTL_DETAIL_CAT_113(a##b, __VA_ARGS__)
493 #define PPUTL_DETAIL_CAT_115(a, b, ...) PPUTL_DETAIL_CAT_114(a##b, __VA_ARGS__)
494 #define PPUTL_DETAIL_CAT_116(a, b, ...) PPUTL_DETAIL_CAT_115(a##b, __VA_ARGS__)
495 #define PPUTL_DETAIL_CAT_117(a, b, ...) PPUTL_DETAIL_CAT_116(a##b, __VA_ARGS__)
496 #define PPUTL_DETAIL_CAT_118(a, b, ...) PPUTL_DETAIL_CAT_117(a##b, __VA_ARGS__)
497 #define PPUTL_DETAIL_CAT_119(a, b, ...) PPUTL_DETAIL_CAT_118(a##b, __VA_ARGS__)
498 #define PPUTL_DETAIL_CAT_120(a, b, ...) PPUTL_DETAIL_CAT_119(a##b, __VA_ARGS__)
499 #define PPUTL_DETAIL_CAT_121(a, b, ...) PPUTL_DETAIL_CAT_120(a##b, __VA_ARGS__)
500 #define PPUTL_DETAIL_CAT_122(a, b, ...) PPUTL_DETAIL_CAT_121(a##b, __VA_ARGS__)
501 #define PPUTL_DETAIL_CAT_123(a, b, ...) PPUTL_DETAIL_CAT_122(a##b, __VA_ARGS__)
502 #define PPUTL_DETAIL_CAT_124(a, b, ...) PPUTL_DETAIL_CAT_123(a##b, __VA_ARGS__)
503 #define PPUTL_DETAIL_CAT_125(a, b, ...) PPUTL_DETAIL_CAT_124(a##b, __VA_ARGS__)
504 #define PPUTL_DETAIL_CAT_126(a, b, ...) PPUTL_DETAIL_CAT_125(a##b, __VA_ARGS__)
505 #define PPUTL_DETAIL_CAT_127(a, b, ...) PPUTL_DETAIL_CAT_126(a##b, __VA_ARGS__)
506 #define PPUTL_DETAIL_CAT_128(a, b, ...) PPUTL_DETAIL_CAT_127(a##b, __VA_ARGS__)
507 #define PPUTL_DETAIL_CAT_129(a, b, ...) PPUTL_DETAIL_CAT_128(a##b, __VA_ARGS__)
508 #define PPUTL_DETAIL_CAT_130(a, b, ...) PPUTL_DETAIL_CAT_129(a##b, __VA_ARGS__)
509 #define PPUTL_DETAIL_CAT_131(a, b, ...) PPUTL_DETAIL_CAT_130(a##b, __VA_ARGS__)
510 #define PPUTL_DETAIL_CAT_132(a, b, ...) PPUTL_DETAIL_CAT_131(a##b, __VA_ARGS__)
511 #define PPUTL_DETAIL_CAT_133(a, b, ...) PPUTL_DETAIL_CAT_132(a##b, __VA_ARGS__)
512 #define PPUTL_DETAIL_CAT_134(a, b, ...) PPUTL_DETAIL_CAT_133(a##b, __VA_ARGS__)
513 #define PPUTL_DETAIL_CAT_135(a, b, ...) PPUTL_DETAIL_CAT_134(a##b, __VA_ARGS__)
514 #define PPUTL_DETAIL_CAT_136(a, b, ...) PPUTL_DETAIL_CAT_135(a##b, __VA_ARGS__)
515 #define PPUTL_DETAIL_CAT_137(a, b, ...) PPUTL_DETAIL_CAT_136(a##b, __VA_ARGS__)
516 #define PPUTL_DETAIL_CAT_138(a, b, ...) PPUTL_DETAIL_CAT_137(a##b, __VA_ARGS__)
517 #define PPUTL_DETAIL_CAT_139(a, b, ...) PPUTL_DETAIL_CAT_138(a##b, __VA_ARGS__)
518 #define PPUTL_DETAIL_CAT_140(a, b, ...) PPUTL_DETAIL_CAT_139(a##b, __VA_ARGS__)
519 #define PPUTL_DETAIL_CAT_141(a, b, ...) PPUTL_DETAIL_CAT_140(a##b, __VA_ARGS__)
520 #define PPUTL_DETAIL_CAT_142(a, b, ...) PPUTL_DETAIL_CAT_141(a##b, __VA_ARGS__)
521 #define PPUTL_DETAIL_CAT_143(a, b, ...) PPUTL_DETAIL_CAT_142(a##b, __VA_ARGS__)
522 #define PPUTL_DETAIL_CAT_144(a, b, ...) PPUTL_DETAIL_CAT_143(a##b, __VA_ARGS__)
523 #define PPUTL_DETAIL_CAT_145(a, b, ...) PPUTL_DETAIL_CAT_144(a##b, __VA_ARGS__)
524 #define PPUTL_DETAIL_CAT_146(a, b, ...) PPUTL_DETAIL_CAT_145(a##b, __VA_ARGS__)
525 #define PPUTL_DETAIL_CAT_147(a, b, ...) PPUTL_DETAIL_CAT_146(a##b, __VA_ARGS__)
526 #define PPUTL_DETAIL_CAT_148(a, b, ...) PPUTL_DETAIL_CAT_147(a##b, __VA_ARGS__)
527 #define PPUTL_DETAIL_CAT_149(a, b, ...) PPUTL_DETAIL_CAT_148(a##b, __VA_ARGS__)
528 #define PPUTL_DETAIL_CAT_150(a, b, ...) PPUTL_DETAIL_CAT_149(a##b, __VA_ARGS__)
529 #define PPUTL_DETAIL_CAT_151(a, b, ...) PPUTL_DETAIL_CAT_150(a##b, __VA_ARGS__)
530 #define PPUTL_DETAIL_CAT_152(a, b, ...) PPUTL_DETAIL_CAT_151(a##b, __VA_ARGS__)
531 #define PPUTL_DETAIL_CAT_153(a, b, ...) PPUTL_DETAIL_CAT_152(a##b, __VA_ARGS__)
532 #define PPUTL_DETAIL_CAT_154(a, b, ...) PPUTL_DETAIL_CAT_153(a##b, __VA_ARGS__)
533 #define PPUTL_DETAIL_CAT_155(a, b, ...) PPUTL_DETAIL_CAT_154(a##b, __VA_ARGS__)
534 #define PPUTL_DETAIL_CAT_156(a, b, ...) PPUTL_DETAIL_CAT_155(a##b, __VA_ARGS__)
535 #define PPUTL_DETAIL_CAT_157(a, b, ...) PPUTL_DETAIL_CAT_156(a##b, __VA_ARGS__)
536 #define PPUTL_DETAIL_CAT_158(a, b, ...) PPUTL_DETAIL_CAT_157(a##b, __VA_ARGS__)
537 #define PPUTL_DETAIL_CAT_159(a, b, ...) PPUTL_DETAIL_CAT_158(a##b, __VA_ARGS__)
538 #define PPUTL_DETAIL_CAT_160(a, b, ...) PPUTL_DETAIL_CAT_159(a##b, __VA_ARGS__)
539 #define PPUTL_DETAIL_CAT_161(a, b, ...) PPUTL_DETAIL_CAT_160(a##b, __VA_ARGS__)
540 #define PPUTL_DETAIL_CAT_162(a, b, ...) PPUTL_DETAIL_CAT_161(a##b, __VA_ARGS__)
541 #define PPUTL_DETAIL_CAT_163(a, b, ...) PPUTL_DETAIL_CAT_162(a##b, __VA_ARGS__)
542 #define PPUTL_DETAIL_CAT_164(a, b, ...) PPUTL_DETAIL_CAT_163(a##b, __VA_ARGS__)
543 #define PPUTL_DETAIL_CAT_165(a, b, ...) PPUTL_DETAIL_CAT_164(a##b, __VA_ARGS__)
544 #define PPUTL_DETAIL_CAT_166(a, b, ...) PPUTL_DETAIL_CAT_165(a##b, __VA_ARGS__)
545 #define PPUTL_DETAIL_CAT_167(a, b, ...) PPUTL_DETAIL_CAT_166(a##b, __VA_ARGS__)
546 #define PPUTL_DETAIL_CAT_168(a, b, ...) PPUTL_DETAIL_CAT_167(a##b, __VA_ARGS__)
547 #define PPUTL_DETAIL_CAT_169(a, b, ...) PPUTL_DETAIL_CAT_168(a##b, __VA_ARGS__)
548 #define PPUTL_DETAIL_CAT_170(a, b, ...) PPUTL_DETAIL_CAT_169(a##b, __VA_ARGS__)
549 #define PPUTL_DETAIL_CAT_171(a, b, ...) PPUTL_DETAIL_CAT_170(a##b, __VA_ARGS__)
550 #define PPUTL_DETAIL_CAT_172(a, b, ...) PPUTL_DETAIL_CAT_171(a##b, __VA_ARGS__)
551 #define PPUTL_DETAIL_CAT_173(a, b, ...) PPUTL_DETAIL_CAT_172(a##b, __VA_ARGS__)
552 #define PPUTL_DETAIL_CAT_174(a, b, ...) PPUTL_DETAIL_CAT_173(a##b, __VA_ARGS__)
553 #define PPUTL_DETAIL_CAT_175(a, b, ...) PPUTL_DETAIL_CAT_174(a##b, __VA_ARGS__)
554 #define PPUTL_DETAIL_CAT_176(a, b, ...) PPUTL_DETAIL_CAT_175(a##b, __VA_ARGS__)
555 #define PPUTL_DETAIL_CAT_177(a, b, ...) PPUTL_DETAIL_CAT_176(a##b, __VA_ARGS__)
556 #define PPUTL_DETAIL_CAT_178(a, b, ...) PPUTL_DETAIL_CAT_177(a##b, __VA_ARGS__)
557 #define PPUTL_DETAIL_CAT_179(a, b, ...) PPUTL_DETAIL_CAT_178(a##b, __VA_ARGS__)
558 #define PPUTL_DETAIL_CAT_180(a, b, ...) PPUTL_DETAIL_CAT_179(a##b, __VA_ARGS__)
559 #define PPUTL_DETAIL_CAT_181(a, b, ...) PPUTL_DETAIL_CAT_180(a##b, __VA_ARGS__)
560 #define PPUTL_DETAIL_CAT_182(a, b, ...) PPUTL_DETAIL_CAT_181(a##b, __VA_ARGS__)
561 #define PPUTL_DETAIL_CAT_183(a, b, ...) PPUTL_DETAIL_CAT_182(a##b, __VA_ARGS__)
562 #define PPUTL_DETAIL_CAT_184(a, b, ...) PPUTL_DETAIL_CAT_183(a##b, __VA_ARGS__)
563 #define PPUTL_DETAIL_CAT_185(a, b, ...) PPUTL_DETAIL_CAT_184(a##b, __VA_ARGS__)
564 #define PPUTL_DETAIL_CAT_186(a, b, ...) PPUTL_DETAIL_CAT_185(a##b, __VA_ARGS__)
565 #define PPUTL_DETAIL_CAT_187(a, b, ...) PPUTL_DETAIL_CAT_186(a##b, __VA_ARGS__)
566 #define PPUTL_DETAIL_CAT_188(a, b, ...) PPUTL_DETAIL_CAT_187(a##b, __VA_ARGS__)
567 #define PPUTL_DETAIL_CAT_189(a, b, ...) PPUTL_DETAIL_CAT_188(a##b, __VA_ARGS__)
568 #define PPUTL_DETAIL_CAT_190(a, b, ...) PPUTL_DETAIL_CAT_189(a##b, __VA_ARGS__)
569 #define PPUTL_DETAIL_CAT_191(a, b, ...) PPUTL_DETAIL_CAT_190(a##b, __VA_ARGS__)
570 #define PPUTL_DETAIL_CAT_192(a, b, ...) PPUTL_DETAIL_CAT_191(a##b, __VA_ARGS__)
571 #define PPUTL_DETAIL_CAT_193(a, b, ...) PPUTL_DETAIL_CAT_192(a##b, __VA_ARGS__)
572 #define PPUTL_DETAIL_CAT_194(a, b, ...) PPUTL_DETAIL_CAT_193(a##b, __VA_ARGS__)
573 #define PPUTL_DETAIL_CAT_195(a, b, ...) PPUTL_DETAIL_CAT_194(a##b, __VA_ARGS__)
574 #define PPUTL_DETAIL_CAT_196(a, b, ...) PPUTL_DETAIL_CAT_195(a##b, __VA_ARGS__)
575 #define PPUTL_DETAIL_CAT_197(a, b, ...) PPUTL_DETAIL_CAT_196(a##b, __VA_ARGS__)
576 #define PPUTL_DETAIL_CAT_198(a, b, ...) PPUTL_DETAIL_CAT_197(a##b, __VA_ARGS__)
577 #define PPUTL_DETAIL_CAT_199(a, b, ...) PPUTL_DETAIL_CAT_198(a##b, __VA_ARGS__)
578 #define PPUTL_DETAIL_CAT_200(a, b, ...) PPUTL_DETAIL_CAT_199(a##b, __VA_ARGS__)
579 #define PPUTL_DETAIL_CAT_201(a, b, ...) PPUTL_DETAIL_CAT_200(a##b, __VA_ARGS__)
580 #define PPUTL_DETAIL_CAT_202(a, b, ...) PPUTL_DETAIL_CAT_201(a##b, __VA_ARGS__)
581 #define PPUTL_DETAIL_CAT_203(a, b, ...) PPUTL_DETAIL_CAT_202(a##b, __VA_ARGS__)
582 #define PPUTL_DETAIL_CAT_204(a, b, ...) PPUTL_DETAIL_CAT_203(a##b, __VA_ARGS__)
583 #define PPUTL_DETAIL_CAT_205(a, b, ...) PPUTL_DETAIL_CAT_204(a##b, __VA_ARGS__)
584 #define PPUTL_DETAIL_CAT_206(a, b, ...) PPUTL_DETAIL_CAT_205(a##b, __VA_ARGS__)
585 #define PPUTL_DETAIL_CAT_207(a, b, ...) PPUTL_DETAIL_CAT_206(a##b, __VA_ARGS__)
586 #define PPUTL_DETAIL_CAT_208(a, b, ...) PPUTL_DETAIL_CAT_207(a##b, __VA_ARGS__)
587 #define PPUTL_DETAIL_CAT_209(a, b, ...) PPUTL_DETAIL_CAT_208(a##b, __VA_ARGS__)
588 #define PPUTL_DETAIL_CAT_210(a, b, ...) PPUTL_DETAIL_CAT_209(a##b, __VA_ARGS__)
589 #define PPUTL_DETAIL_CAT_211(a, b, ...) PPUTL_DETAIL_CAT_210(a##b, __VA_ARGS__)
590 #define PPUTL_DETAIL_CAT_212(a, b, ...) PPUTL_DETAIL_CAT_211(a##b, __VA_ARGS__)
591 #define PPUTL_DETAIL_CAT_213(a, b, ...) PPUTL_DETAIL_CAT_212(a##b, __VA_ARGS__)
592 #define PPUTL_DETAIL_CAT_214(a, b, ...) PPUTL_DETAIL_CAT_213(a##b, __VA_ARGS__)
593 #define PPUTL_DETAIL_CAT_215(a, b, ...) PPUTL_DETAIL_CAT_214(a##b, __VA_ARGS__)
594 #define PPUTL_DETAIL_CAT_216(a, b, ...) PPUTL_DETAIL_CAT_215(a##b, __VA_ARGS__)
595 #define PPUTL_DETAIL_CAT_217(a, b, ...) PPUTL_DETAIL_CAT_216(a##b, __VA_ARGS__)
596 #define PPUTL_DETAIL_CAT_218(a, b, ...) PPUTL_DETAIL_CAT_217(a##b, __VA_ARGS__)
597 #define PPUTL_DETAIL_CAT_219(a, b, ...) PPUTL_DETAIL_CAT_218(a##b, __VA_ARGS__)
598 #define PPUTL_DETAIL_CAT_220(a, b, ...) PPUTL_DETAIL_CAT_219(a##b, __VA_ARGS__)
599 #define PPUTL_DETAIL_CAT_221(a, b, ...) PPUTL_DETAIL_CAT_220(a##b, __VA_ARGS__)
600 #define PPUTL_DETAIL_CAT_222(a, b, ...) PPUTL_DETAIL_CAT_221(a##b, __VA_ARGS__)
601 #define PPUTL_DETAIL_CAT_223(a, b, ...) PPUTL_DETAIL_CAT_222(a##b, __VA_ARGS__)
602 #define PPUTL_DETAIL_CAT_224(a, b, ...) PPUTL_DETAIL_CAT_223(a##b, __VA_ARGS__)
603 #define PPUTL_DETAIL_CAT_225(a, b, ...) PPUTL_DETAIL_CAT_224(a##b, __VA_ARGS__)
604 #define PPUTL_DETAIL_CAT_226(a, b, ...) PPUTL_DETAIL_CAT_225(a##b, __VA_ARGS__)
605 #define PPUTL_DETAIL_CAT_227(a, b, ...) PPUTL_DETAIL_CAT_226(a##b, __VA_ARGS__)
606 #define PPUTL_DETAIL_CAT_228(a, b, ...) PPUTL_DETAIL_CAT_227(a##b, __VA_ARGS__)
607 #define PPUTL_DETAIL_CAT_229(a, b, ...) PPUTL_DETAIL_CAT_228(a##b, __VA_ARGS__)
608 #define PPUTL_DETAIL_CAT_230(a, b, ...) PPUTL_DETAIL_CAT_229(a##b, __VA_ARGS__)
609 #define PPUTL_DETAIL_CAT_231(a, b, ...) PPUTL_DETAIL_CAT_230(a##b, __VA_ARGS__)
610 #define PPUTL_DETAIL_CAT_232(a, b, ...) PPUTL_DETAIL_CAT_231(a##b, __VA_ARGS__)
611 #define PPUTL_DETAIL_CAT_233(a, b, ...) PPUTL_DETAIL_CAT_232(a##b, __VA_ARGS__)
612 #define PPUTL_DETAIL_CAT_234(a, b, ...) PPUTL_DETAIL_CAT_233(a##b, __VA_ARGS__)
613 #define PPUTL_DETAIL_CAT_235(a, b, ...) PPUTL_DETAIL_CAT_234(a##b, __VA_ARGS__)
614 #define PPUTL_DETAIL_CAT_236(a, b, ...) PPUTL_DETAIL_CAT_235(a##b, __VA_ARGS__)
615 #define PPUTL_DETAIL_CAT_237(a, b, ...) PPUTL_DETAIL_CAT_236(a##b, __VA_ARGS__)
616 #define PPUTL_DETAIL_CAT_238(a, b, ...) PPUTL_DETAIL_CAT_237(a##b, __VA_ARGS__)
617 #define PPUTL_DETAIL_CAT_239(a, b, ...) PPUTL_DETAIL_CAT_238(a##b, __VA_ARGS__)
618 #define PPUTL_DETAIL_CAT_240(a, b, ...) PPUTL_DETAIL_CAT_239(a##b, __VA_ARGS__)
619 #define PPUTL_DETAIL_CAT_241(a, b, ...) PPUTL_DETAIL_CAT_240(a##b, __VA_ARGS__)
620 #define PPUTL_DETAIL_CAT_242(a, b, ...) PPUTL_DETAIL_CAT_241(a##b, __VA_ARGS__)
621 #define PPUTL_DETAIL_CAT_243(a, b, ...) PPUTL_DETAIL_CAT_242(a##b, __VA_ARGS__)
622 #define PPUTL_DETAIL_CAT_244(a, b, ...) PPUTL_DETAIL_CAT_243(a##b, __VA_ARGS__)
623 #define PPUTL_DETAIL_CAT_245(a, b, ...) PPUTL_DETAIL_CAT_244(a##b, __VA_ARGS__)
624 #define PPUTL_DETAIL_CAT_246(a, b, ...) PPUTL_DETAIL_CAT_245(a##b, __VA_ARGS__)
625 #define PPUTL_DETAIL_CAT_247(a, b, ...) PPUTL_DETAIL_CAT_246(a##b, __VA_ARGS__)
626 #define PPUTL_DETAIL_CAT_248(a, b, ...) PPUTL_DETAIL_CAT_247(a##b, __VA_ARGS__)
627 #define PPUTL_DETAIL_CAT_249(a, b, ...) PPUTL_DETAIL_CAT_248(a##b, __VA_ARGS__)
628 #define PPUTL_DETAIL_CAT_250(a, b, ...) PPUTL_DETAIL_CAT_249(a##b, __VA_ARGS__)
629 #define PPUTL_DETAIL_CAT_251(a, b, ...) PPUTL_DETAIL_CAT_250(a##b, __VA_ARGS__)
630 #define PPUTL_DETAIL_CAT_252(a, b, ...) PPUTL_DETAIL_CAT_251(a##b, __VA_ARGS__)
631 #define PPUTL_DETAIL_CAT_253(a, b, ...) PPUTL_DETAIL_CAT_252(a##b, __VA_ARGS__)
632 #define PPUTL_DETAIL_CAT_254(a, b, ...) PPUTL_DETAIL_CAT_253(a##b, __VA_ARGS__)
633 #define PPUTL_DETAIL_CAT_255(a, b, ...) PPUTL_DETAIL_CAT_254(a##b, __VA_ARGS__)
641 #ifndef CCUTL_NAMESPACE
642 #define CCUTL_NAMESPACE ctl
645 namespace CCUTL_NAMESPACE {
650 #ifndef CCUTL_EXISTS_CONCEPT_INCLUDED
651 #define CCUTL_EXISTS_CONCEPT_INCLUDED
693 #define CTL_EXISTS_CONCEPT(name, template_params_tuple, template_args_tuple) \
695 template <PPUTL_TUPLE_ARGS(template_params_tuple)> class Template_, \
696 PPUTL_TUPLE_ARGS(template_params_tuple)> \
697 concept name = requires { \
698 typename Template_<PPUTL_TUPLE_ARGS(template_args_tuple)>; \
703 #define CCUTL_EXISTS_CONCEPT_VERSION_MAJOR 0
704 #define CCUTL_EXISTS_CONCEPT_VERSION_MINOR 3
705 #define CCUTL_EXISTS_CONCEPT_VERSION_PATCH 2
707 #elif CCUTL_EXISTS_CONCEPT_VERSION_MAJOR != 0
708 #error ccutl.exists_concept major version mismatch
709 #elif CCUTL_EXISTS_CONCEPT_VERSION_MINOR != 3
710 #error ccutl.exists_concept minor version mismatch
711 #elif CCUTL_EXISTS_CONCEPT_VERSION_PATCH != 2
712 #warning ccutl.exists_concept patch version mismatch
721 #ifndef CCUTL_RMCV_INCLUDED
722 #define CCUTL_RMCV_INCLUDED
732 using rmcv = std::remove_cv_t<T>;
736 #define CCUTL_RMCV_VERSION_MAJOR 0
737 #define CCUTL_RMCV_VERSION_MINOR 3
738 #define CCUTL_RMCV_VERSION_PATCH 2
740 #elif CCUTL_RMCV_VERSION_MAJOR != 0
741 #error ccutl.rmcv major version mismatch
742 #elif CCUTL_RMCV_VERSION_MINOR != 3
743 #error ccutl.rmcv minor version mismatch
744 #elif CCUTL_RMCV_VERSION_PATCH != 2
745 #warning ccutl.rmcv patch version mismatch
754 #ifndef CCUTL_RMREF_INCLUDED
755 #define CCUTL_RMREF_INCLUDED
765 using rmref = std::remove_reference_t<T>;
769 #define CCUTL_RMREF_VERSION_MAJOR 0
770 #define CCUTL_RMREF_VERSION_MINOR 3
771 #define CCUTL_RMREF_VERSION_PATCH 2
773 #elif CCUTL_RMREF_VERSION_MAJOR != 0
774 #error ccutl.rmref major version mismatch
775 #elif CCUTL_RMREF_VERSION_MINOR != 3
776 #error ccutl.rmref minor version mismatch
777 #elif CCUTL_RMREF_VERSION_PATCH != 2
778 #warning ccutl.rmref patch version mismatch
787 #ifndef CCUTL_EXISTS_INCLUDED
788 #define CCUTL_EXISTS_INCLUDED
821 template <
template <
class...>
class Template,
class... Args>
822 concept
exists = detail::exists::impl<Template, Args...>;
826 #define CCUTL_EXISTS_VERSION_MAJOR 0
827 #define CCUTL_EXISTS_VERSION_MINOR 3
828 #define CCUTL_EXISTS_VERSION_PATCH 2
830 #elif CCUTL_EXISTS_VERSION_MAJOR != 0
831 #error ccutl.exists major version mismatch
832 #elif CCUTL_EXISTS_VERSION_MINOR != 3
833 #error ccutl.exists minor version mismatch
834 #elif CCUTL_EXISTS_VERSION_PATCH != 2
835 #warning ccutl.exists patch version mismatch
844 #ifndef CCUTL_FWD_INCLUDED
845 #define CCUTL_FWD_INCLUDED
879 return static_cast<T&&
>(t);
892 !std::is_lvalue_reference_v<T>,
893 "cannot instantiate an rvalue forwarder with an lvalue reference type");
894 return static_cast<T&&
>(t);
899 #define CCUTL_FWD_VERSION_MAJOR 0
900 #define CCUTL_FWD_VERSION_MINOR 3
901 #define CCUTL_FWD_VERSION_PATCH 2
903 #elif CCUTL_FWD_VERSION_MAJOR != 0
904 #error ccutl.fwd major version mismatch
905 #elif CCUTL_FWD_VERSION_MINOR != 3
906 #error ccutl.fwd minor version mismatch
907 #elif CCUTL_FWD_VERSION_PATCH != 2
908 #warning ccutl.fwd patch version mismatch
917 #ifndef CCUTL_LOWEST_INCLUDED
918 #define CCUTL_LOWEST_INCLUDED
927 ctl::exists<std::numeric_limits, T>and
requires() {
929 ->std::convertible_to<T>;
933 concept
arithmetic = std::integral<T> || std::floating_point<T>;
954 template <detail::lowest::arithmetic Arithmetic>
955 requires detail::lowest::has_numeric_limits_lowest<Arithmetic>
961 #define CCUTL_LOWEST_VERSION_MAJOR 0
962 #define CCUTL_LOWEST_VERSION_MINOR 3
963 #define CCUTL_LOWEST_VERSION_PATCH 2
965 #elif CCUTL_LOWEST_VERSION_MAJOR != 0
966 #error ccutl.lowest major version mismatch
967 #elif CCUTL_LOWEST_VERSION_MINOR != 3
968 #error ccutl.lowest minor version mismatch
969 #elif CCUTL_LOWEST_VERSION_PATCH != 2
970 #warning ccutl.lowest patch version mismatch
979 #ifndef CCUTL_RMCVREF_INCLUDED
980 #define CCUTL_RMCVREF_INCLUDED
994 #define CCUTL_RMCVREF_VERSION_MAJOR 0
995 #define CCUTL_RMCVREF_VERSION_MINOR 3
996 #define CCUTL_RMCVREF_VERSION_PATCH 2
998 #elif CCUTL_RMCVREF_VERSION_MAJOR != 0
999 #error ccutl.rmcvref major version mismatch
1000 #elif CCUTL_RMCVREF_VERSION_MINOR != 3
1001 #error ccutl.rmcvref minor version mismatch
1002 #elif CCUTL_RMCVREF_VERSION_PATCH != 2
1003 #warning ccutl.rmcvref patch version mismatch
1012 #ifndef CCUTL_TARG_INCLUDED
1013 #define CCUTL_TARG_INCLUDED
1020 template <std::size_t, std::size_t,
class...>
1023 template <std::size_t
targ,
class First,
class... Rest>
1028 template <std::size_t
targ, std::size_t i,
class First,
class... Rest>
1030 using type =
typename impl<
targ, i + 1, Rest...>::type;
1033 template <std::size_t
targ,
class... Pack>
1036 template <std::size_t idx,
class... Ts>
1037 inline constexpr
bool
1058 template <std::size_t idx,
class... Ts>
1059 requires detail::targ::valid_indexable_pack<idx, Ts...>
1060 using targ = detail::targ::type<idx, Ts...>;
1066 #define CCUTL_TARG_VERSION_MAJOR 0
1067 #define CCUTL_TARG_VERSION_MINOR 3
1068 #define CCUTL_TARG_VERSION_PATCH 2
1070 #elif CCUTL_TARG_VERSION_MAJOR != 0
1071 #error ccutl.targ major version mismatch
1072 #elif CCUTL_TARG_VERSION_MINOR != 3
1073 #error ccutl.targ minor version mismatch
1074 #elif CCUTL_TARG_VERSION_PATCH != 2
1075 #warning ccutl.targ patch version mismatch
1084 #ifndef CCUTL_TYPEOF_CONCEPT_INCLUDED
1085 #define CCUTL_TYPEOF_CONCEPT_INCLUDED
1130 #define CTL_TYPEOF_CONCEPT(name, template_params_tuple, template_args_tuple) \
1131 namespace detail { \
1132 namespace PPUTL_CAT(name, _concept_) { \
1134 template <template <PPUTL_TUPLE_ARGS(template_params_tuple)> class, class> \
1136 static constexpr bool result = false; \
1140 template <PPUTL_TUPLE_ARGS(template_params_tuple)> class Template_, \
1141 PPUTL_TUPLE_ARGS(template_params_tuple)> \
1142 struct test<Template_, Template_<PPUTL_TUPLE_ARGS(template_args_tuple)>> { \
1143 static constexpr bool result = true; \
1151 template <PPUTL_TUPLE_ARGS(template_params_tuple)> class Template_> \
1153 detail::PPUTL_CAT(name, _concept_)::test<Template_, T_>::result
1157 #define CCUTL_TYPEOF_CONCEPT_VERSION_MAJOR 0
1158 #define CCUTL_TYPEOF_CONCEPT_VERSION_MINOR 3
1159 #define CCUTL_TYPEOF_CONCEPT_VERSION_PATCH 2
1161 #elif CCUTL_TYPEOF_CONCEPT_VERSION_MAJOR != 0
1162 #error ccutl.typeof_concept major version mismatch
1163 #elif CCUTL_TYPEOF_CONCEPT_VERSION_MINOR != 3
1164 #error ccutl.typeof_concept minor version mismatch
1165 #elif CCUTL_TYPEOF_CONCEPT_VERSION_PATCH != 2
1166 #warning ccutl.typeof_concept patch version mismatch
1175 #ifndef CCUTL_ARG_INCLUDED
1176 #define CCUTL_ARG_INCLUDED
1185 template <std::size_t
targ, std::size_t i,
class First,
class... Rest>
1186 requires (
targ == i) && (std::is_lvalue_reference_v<First &&>)
1187 [[nodiscard]]
inline constexpr First &
1188 impl(First&& first, Rest &&...) noexcept {
1189 return fwd<First>(first);
1193 template <std::size_t
targ, std::size_t i,
class First,
class... Rest>
1194 requires (
targ == i) && (std::is_rvalue_reference_v<First &&>)
1195 [[nodiscard]]
inline constexpr First &&
1196 impl(First&& first, Rest &&...) noexcept {
1197 return fwd<First>(first);
1201 template <std::size_t
targ, std::size_t i,
class First,
class... Rest>
1203 [[nodiscard]]
inline constexpr
auto &&
1204 impl(First &&, Rest &&... rest) noexcept {
1205 return impl<targ, i + 1>(fwd<Rest>(rest)...);
1209 template <std::size_t idx,
class... Ts>
1210 inline constexpr
bool
1211 valid_indexable_pack =
sizeof...(Ts) > 0 && idx <
sizeof...(Ts);
1231 template <std::size_t idx,
class... Ts>
1232 requires detail::arg::valid_indexable_pack<idx, Ts...>
1233 [[nodiscard]]
inline constexpr
auto &&
1235 return detail::arg::impl<idx, 0>(fwd<Ts>(args)...);
1242 #define CCUTL_ARG_VERSION_MAJOR 0
1243 #define CCUTL_ARG_VERSION_MINOR 3
1244 #define CCUTL_ARG_VERSION_PATCH 2
1246 #elif CCUTL_ARG_VERSION_MAJOR != 0
1247 #error ccutl.arg major version mismatch
1248 #elif CCUTL_ARG_VERSION_MINOR != 3
1249 #error ccutl.arg minor version mismatch
1250 #elif CCUTL_ARG_VERSION_PATCH != 2
1251 #warning ccutl.arg patch version mismatch
1260 #ifndef CCUTL_FOUND_INCLUDED
1261 #define CCUTL_FOUND_INCLUDED
1275 std::input_iterator I, std::sentinel_for<I> S,
class T,
1276 class Proj = std::identity>
1277 requires std::indirect_binary_predicate<std::ranges::equal_to,
1278 std::projected<I, Proj>, T
const*>
1279 [[nodiscard]]
inline constexpr
bool
1280 found(I first, S last, T
const& value, Proj proj = {}) {
1281 return std::ranges::find(first, last, value, proj) != last;
1291 template <std::ranges::input_range R,
class T,
class Proj = std::
identity>
1292 requires std::indirect_binary_predicate<
1293 std::ranges::equal_to, std::projected<std::ranges::iterator_t<R>, Proj>,
1295 [[nodiscard]]
inline constexpr
bool
1296 found(R&& r, T
const& value, Proj proj = {}) {
1297 return std::ranges::find(fwd<R>(r), value, proj) != std::ranges::end(r);
1302 #define CCUTL_FOUND_VERSION_MAJOR 0
1303 #define CCUTL_FOUND_VERSION_MINOR 3
1304 #define CCUTL_FOUND_VERSION_PATCH 2
1306 #elif CCUTL_FOUND_VERSION_MAJOR != 0
1307 #error ccutl.found major version mismatch
1308 #elif CCUTL_FOUND_VERSION_MINOR != 3
1309 #error ccutl.found minor version mismatch
1310 #elif CCUTL_FOUND_VERSION_PATCH != 2
1311 #warning ccutl.found patch version mismatch
1320 #ifndef CCUTL_HIGHEST_INCLUDED
1321 #define CCUTL_HIGHEST_INCLUDED
1330 { std::numeric_limits<T>::max() }
1331 ->std::convertible_to<T>;
1336 concept arithmetic = std::integral<T> || std::floating_point<T>;
1357 template <detail::highest::arithmetic Arithmetic>
1358 requires detail::highest::has_numeric_limits_max<Arithmetic>
1359 inline constexpr Arithmetic
highest = std::numeric_limits<Arithmetic>::max();
1364 #define CCUTL_HIGHEST_VERSION_MAJOR 0
1365 #define CCUTL_HIGHEST_VERSION_MINOR 3
1366 #define CCUTL_HIGHEST_VERSION_PATCH 2
1368 #elif CCUTL_HIGHEST_VERSION_MAJOR != 0
1369 #error ccutl.highest major version mismatch
1370 #elif CCUTL_HIGHEST_VERSION_MINOR != 3
1371 #error ccutl.highest minor version mismatch
1372 #elif CCUTL_HIGHEST_VERSION_PATCH != 2
1373 #warning ccutl.highest patch version mismatch
1382 #ifndef CCUTL_MV_INCLUDED
1383 #define CCUTL_MV_INCLUDED
1417 #define CCUTL_MV_VERSION_MAJOR 0
1418 #define CCUTL_MV_VERSION_MINOR 3
1419 #define CCUTL_MV_VERSION_PATCH 2
1421 #elif CCUTL_MV_VERSION_MAJOR != 0
1422 #error ccutl.mv major version mismatch
1423 #elif CCUTL_MV_VERSION_MINOR != 3
1424 #error ccutl.mv minor version mismatch
1425 #elif CCUTL_MV_VERSION_PATCH != 2
1426 #warning ccutl.mv patch version mismatch
1435 #ifndef CCUTL_TYPEOF_INCLUDED
1436 #define CCUTL_TYPEOF_INCLUDED
1462 template <
class T,
template <
class...>
class Template>
1463 concept
typeof = detail::typeof ::impl<T, Template>;
1467 #define CCUTL_TYPEOF_VERSION_MAJOR 0
1468 #define CCUTL_TYPEOF_VERSION_MINOR 3
1469 #define CCUTL_TYPEOF_VERSION_PATCH 2
1471 #elif CCUTL_TYPEOF_VERSION_MAJOR != 0
1472 #error ccutl.typeof major version mismatch
1473 #elif CCUTL_TYPEOF_VERSION_MINOR != 3
1474 #error ccutl.typeof minor version mismatch
1475 #elif CCUTL_TYPEOF_VERSION_PATCH != 2
1476 #warning ccutl.typeof patch version mismatch
1485 #ifndef CCUTL_FOUND_IF_INCLUDED
1486 #define CCUTL_FOUND_IF_INCLUDED
1500 std::input_iterator I, std::sentinel_for<I> S,
class Proj = std::identity,
1501 std::indirect_unary_predicate<std::projected<I, Proj>> Pred>
1502 [[nodiscard]]
inline constexpr
bool
1503 found_if(I first, S last, Pred pred = {}, Proj proj = {}) {
1504 return std::ranges::find_if(first, last, pred, proj) != last;
1515 std::ranges::input_range R,
class Proj = std::identity,
1516 std::indirect_unary_predicate<
1517 std::projected<std::ranges::iterator_t<R>, Proj>>
1519 [[nodiscard]]
inline constexpr
bool
1521 return std::ranges::find_if(fwd<R>(r), pred, proj) != std::ranges::end(r);
1526 #define CCUTL_FOUND_IF_VERSION_MAJOR 0
1527 #define CCUTL_FOUND_IF_VERSION_MINOR 3
1528 #define CCUTL_FOUND_IF_VERSION_PATCH 2
1530 #elif CCUTL_FOUND_IF_VERSION_MAJOR != 0
1531 #error ccutl.found_if major version mismatch
1532 #elif CCUTL_FOUND_IF_VERSION_MINOR != 3
1533 #error ccutl.found_if minor version mismatch
1534 #elif CCUTL_FOUND_IF_VERSION_PATCH != 2
1535 #warning ccutl.found_if patch version mismatch
1544 #ifndef CCUTL_SAME_INCLUDED
1545 #define CCUTL_SAME_INCLUDED
1555 template <std::size_t i,
class First,
class... Rest>
1556 [[nodiscard]]
inline constexpr
bool
1558 if constexpr (i ==
sizeof...(Rest)) {
1560 }
else if constexpr (
sizeof...(Rest) == 1) {
1562 return (std::is_same_v<First, Rest> && ...);
1564 constexpr
bool this_comparison =
1565 (std::is_same_v<
ctl::targ<i, First, Rest...>, Rest> && ...);
1567 return this_comparison &&
impl<i + 1, Rest..., First>();
1586 template <
class... Ts>
1587 concept
same =
sizeof...(Ts) > 0 and detail::same::impl<0, Ts...>();
1591 #define CCUTL_SAME_VERSION_MAJOR 0
1592 #define CCUTL_SAME_VERSION_MINOR 3
1593 #define CCUTL_SAME_VERSION_PATCH 2
1595 #elif CCUTL_SAME_VERSION_MAJOR != 0
1596 #error ccutl.same major version mismatch
1597 #elif CCUTL_SAME_VERSION_MINOR != 3
1598 #error ccutl.same minor version mismatch
1599 #elif CCUTL_SAME_VERSION_PATCH != 2
1600 #warning ccutl.same patch version mismatch
1609 #ifndef CCUTL_TYPE_PACK_INCLUDED
1610 #define CCUTL_TYPE_PACK_INCLUDED
1620 template <
template <
class...>
class,
class>
1623 template <
template <
class...>
class Template,
class... Rs>
1624 struct from<Template, Template<Rs...>> {
1625 template <
class... Ls>
1626 using type = ctl::type_pack<Ls..., Rs...>;
1631 template <
class... Ts, std::size_t... seq>
1633 [[nodiscard]]
inline constexpr
auto
1634 pop_back(std::index_sequence<seq...> &&) noexcept {
1635 return ctl::type_pack<
ctl::targ<seq, Ts...>...>{};
1638 template <std::size_t n_removed,
class... Ts, std::size_t... seq>
1639 requires (
sizeof...(Ts) > 0 and n_removed <=
sizeof...(Ts))
1640 [[nodiscard]]
static constexpr
auto
1641 pop_front(std::index_sequence<seq...> &&) noexcept {
1642 return ctl::type_pack<
ctl::targ<seq + n_removed, Ts...>...>{};
1645 template <std::size_t begin,
class... Ts, std::size_t... seq>
1647 [[nodiscard]]
static constexpr
auto
1648 slice(std::index_sequence<seq...> &&) noexcept {
1649 return ctl::type_pack<
ctl::targ<seq + begin, Ts...>...>{};
1656 template <
class... Us>
1658 template <
class... Ts>
1659 using type = ctl::type_pack<Ts..., Us...>;
1692 template <
class... Ts>
1699 template <
template <
class...>
class Template,
class... Us>
1703 template <
template <
class...>
class Template,
class... Us>
1715 template <
class...>
class Template, typeof<Template> T>
1721 template <
template <
class...>
class Template>
1723 using to = Template<Ts...>;
1726 static constexpr std::size_t
size =
sizeof...(Ts);
1730 template <std::
size_t idx>
1732 using get =
targ<idx, Ts...>;
1746 template <std::
size_t n_removed = 1ul>
1749 std::remove_const_t<decltype(detail::type_pack::pop_back<Ts...>(
1750 std::make_index_sequence<size - n_removed>()))>;
1754 template <std::
size_t n_removed = 1ul>
1757 std::remove_const_t<
1758 decltype(detail::type_pack::pop_front<n_removed, Ts...>(
1759 std::make_index_sequence<size - n_removed>()))>;
1764 template <std::
size_t begin, std::
size_t end = size>
1767 std::remove_const_t<decltype(detail::type_pack::slice<begin, Ts...>(
1768 std::make_index_sequence<end - begin>()))>;
1773 template <typeof<type_pack> Other>
1775 typename detail::type_pack::concat<Other>::template type<Ts...>;
1779 template <
template <
class...>
class Template,
class... Ts>
1784 #define CCUTL_TYPE_PACK_VERSION_MAJOR 0
1785 #define CCUTL_TYPE_PACK_VERSION_MINOR 3
1786 #define CCUTL_TYPE_PACK_VERSION_PATCH 2
1788 #elif CCUTL_TYPE_PACK_VERSION_MAJOR != 0
1789 #error ccutl.type_pack major version mismatch
1790 #elif CCUTL_TYPE_PACK_VERSION_MINOR != 3
1791 #error ccutl.type_pack minor version mismatch
1792 #elif CCUTL_TYPE_PACK_VERSION_PATCH != 2
1793 #warning ccutl.type_pack patch version mismatch
1802 #ifndef CCUTL_DIFFERENT_INCLUDED
1803 #define CCUTL_DIFFERENT_INCLUDED
1818 template <
class... Ts>
1823 #define CCUTL_DIFFERENT_VERSION_MAJOR 0
1824 #define CCUTL_DIFFERENT_VERSION_MINOR 3
1825 #define CCUTL_DIFFERENT_VERSION_PATCH 2
1827 #elif CCUTL_DIFFERENT_VERSION_MAJOR != 0
1828 #error ccutl.different major version mismatch
1829 #elif CCUTL_DIFFERENT_VERSION_MINOR != 3
1830 #error ccutl.different minor version mismatch
1831 #elif CCUTL_DIFFERENT_VERSION_PATCH != 2
1832 #warning ccutl.different patch version mismatch
1841 #ifndef CCUTL_STREQ_INCLUDED
1842 #define CCUTL_STREQ_INCLUDED
1851 std::string_view{fwd<T>(v)};
1854 template <
stringlike A,
stringlike B>
1855 [[nodiscard]]
inline constexpr
bool
1856 impl(A&& a, B&& b) noexcept {
1857 return std::string_view{fwd<A>(a)} == std::string_view{fwd<B>(b)};
1860 template <stringlike First, stringlike... Rest>
1862 [[nodiscard]]
inline constexpr
bool
1863 impl(First&& first, Rest&&... rest) {
1864 return (impl(fwd<First>(first), fwd<Rest>(rest)) && ...);
1876 template <detail::streq::stringlike... Strings>
1878 [[nodiscard]]
inline constexpr
bool
1879 streq(Strings&&... strings) noexcept {
1880 return detail::streq::impl(fwd<Strings>(strings)...);
1885 #define CCUTL_STREQ_VERSION_MAJOR 0
1886 #define CCUTL_STREQ_VERSION_MINOR 3
1887 #define CCUTL_STREQ_VERSION_PATCH 2
1889 #elif CCUTL_STREQ_VERSION_MAJOR != 0
1890 #error ccutl.streq major version mismatch
1891 #elif CCUTL_STREQ_VERSION_MINOR != 3
1892 #error ccutl.streq minor version mismatch
1893 #elif CCUTL_STREQ_VERSION_PATCH != 2
1894 #warning ccutl.streq patch version mismatch
1903 #ifndef CCUTL_ICMP_INCLUDED
1904 #define CCUTL_ICMP_INCLUDED
1911 template <std::
signed_
integral L, std::
signed_
integral R>
1912 [[nodiscard]]
inline constexpr std::strong_ordering
1917 template <std::
unsigned_
integral L, std::
unsigned_
integral R>
1918 [[nodiscard]]
inline constexpr std::strong_ordering
1923 template <std::
signed_
integral L, std::
unsigned_
integral R>
1924 [[nodiscard]]
inline constexpr std::strong_ordering
1927 return std::strong_ordering::less;
1929 if constexpr (ctl::highest<L> >= ctl::highest<R>)
1930 return impl(l,
static_cast<L
>(r));
1932 return impl(
static_cast<R
>(l), r);
1936 template <std::
unsigned_
integral L, std::
signed_
integral R>
1937 [[nodiscard]]
inline constexpr std::strong_ordering
1940 return std::strong_ordering::greater;
1942 if constexpr (ctl::highest<L> < ctl::highest<R>)
1943 return impl(
static_cast<R
>(l), r);
1945 return impl(l,
static_cast<L
>(r));
1987 template <std::
integral L, std::
integral R>
1988 [[nodiscard]]
inline constexpr std::strong_ordering
1990 return detail::icmp::impl(l, r);
1995 #define CCUTL_ICMP_VERSION_MAJOR 0
1996 #define CCUTL_ICMP_VERSION_MINOR 3
1997 #define CCUTL_ICMP_VERSION_PATCH 2
1999 #elif CCUTL_ICMP_VERSION_MAJOR != 0
2000 #error ccutl.icmp major version mismatch
2001 #elif CCUTL_ICMP_VERSION_MINOR != 3
2002 #error ccutl.icmp minor version mismatch
2003 #elif CCUTL_ICMP_VERSION_PATCH != 2
2004 #warning ccutl.icmp patch version mismatch
2013 #ifndef CCUTL_VALUE_PACK_INCLUDED
2014 #define CCUTL_VALUE_PACK_INCLUDED
2022 namespace value_pack {
2024 template <
template <
auto...>
class,
class>
2027 template <
template <
auto...>
class Template,
auto... rs>
2028 struct from<Template, Template<rs...>> {
2029 template <
auto... ls>
2030 using type = ctl::value_pack<ls..., rs...>;
2034 template <
template <
auto...>
class Template,
auto... vs>
2036 typename Template<vs...>;
2041 template <
auto... vs, std::size_t... seq>
2043 [[nodiscard]]
inline constexpr
auto
2044 pop_back(std::index_sequence<seq...> &&) noexcept {
2045 return ctl::value_pack<ctl::arg<seq>(vs...)...>{};
2048 template <std::size_t n_removed,
auto... vs, std::size_t... seq>
2049 requires (
sizeof...(vs) >= n_removed)
2050 [[nodiscard]]
static constexpr
auto
2051 pop_front(std::index_sequence<seq...> &&) noexcept {
2052 return ctl::value_pack<ctl::arg<seq + n_removed>(vs...)...>{};
2055 template <std::size_t begin,
auto... vs, std::size_t... seq>
2057 [[nodiscard]]
static constexpr
auto
2058 slice(std::index_sequence<seq...> &&) noexcept {
2059 return ctl::value_pack<ctl::arg<seq + begin>(vs...)...>{};
2066 template <
auto... rs>
2068 template <
auto... ls>
2069 using type = ctl::value_pack<ls..., rs...>;
2100 template <
auto... values>
2107 template <
template <
auto...>
class Template,
auto... vs>
2111 template <
template <
auto...>
class Template,
auto... vs>
2121 template <
auto...>
class Template,
2122 detail::value_pack::typeof_vtpl<Template> T>
2127 template <
template <
auto...>
class Template>
2128 requires detail::value_pack::specializable_with_nontypes<Template, values...>
2129 using to = Template<values...>;
2132 static constexpr std::size_t
size =
sizeof...(values);
2139 template <std::
size_t idx>
2144 template <std::
size_t idx>
2145 requires (idx <
sizeof...(values))
2149 template <auto value>
2153 template <auto value>
2158 template <std::
size_t n_removed = 1>
2160 using pop_back = std::remove_const_t<
2161 decltype(detail::value_pack::pop_back<values...>(
2162 std::make_index_sequence<size - n_removed>()))>;
2167 template <std::
size_t n_removed = 1ul>
2169 using pop_front = std::remove_const_t<
2170 decltype(detail::value_pack::pop_front<n_removed, values...>(
2171 std::make_index_sequence<size - n_removed>()))>;
2176 template <std::
size_t begin, std::
size_t end = size>
2178 using slice = std::remove_const_t<
2179 decltype(detail::value_pack::slice<begin, values...>(
2180 std::make_index_sequence<end - begin>()))>;
2185 template <detail::value_pack::typeof_vtpl<value_pack> Other>
2186 using concat =
typename detail::value_pack::concat<Other>::template type<values...>;
2190 template <
template <
auto...>
class Template,
auto... values>
2195 #define CCUTL_VALUE_PACK_VERSION_MAJOR 0
2196 #define CCUTL_VALUE_PACK_VERSION_MINOR 3
2197 #define CCUTL_VALUE_PACK_VERSION_PATCH 2
2199 #elif CCUTL_VALUE_PACK_VERSION_MAJOR != 0
2200 #error ccutl.value_pack major version mismatch
2201 #elif CCUTL_VALUE_PACK_VERSION_MINOR != 3
2202 #error ccutl.value_pack minor version mismatch
2203 #elif CCUTL_VALUE_PACK_VERSION_PATCH != 2
2204 #warning ccutl.value_pack patch version mismatch
2215 #define CCUTL_VERSION_MAJOR 0
2216 #define CCUTL_VERSION_MINOR 3
2217 #define CCUTL_VERSION_PATCH 2
2219 #elif CCUTL_VERSION_MAJOR != 0
2220 #error ccutl major version mismatch
2221 #elif CCUTL_VERSION_MINOR != 3
2222 #error ccutl minor version mismatch
2223 #elif CCUTL_VERSION_PATCH != 2
2224 #warning ccutl patch version mismatch