proxsuite 0.6.7
The Advanced Proximal Optimization Toolbox
Loading...
Searching...
No Matches
macros.hpp
Go to the documentation of this file.
1#ifndef VEG_MACROS_HPP_HSTLSKZXS
2#define VEG_MACROS_HPP_HSTLSKZXS
7#include <initializer_list>
8#include <utility>
9
11
12#if _MSC_VER
13#define PROXSUITE_PRETTY_FUNCTION __FUNCSIG__
14#else
15#define PROXSUITE_PRETTY_FUNCTION __PRETTY_FUNCTION__
16#endif
17
18#define PROXSUITE_THROW_PRETTY(condition, exception, message) \
19 if (condition) { \
20 std::ostringstream ss; \
21 ss << "From file: " << __FILE__ << "\n"; \
22 ss << "in function: " << PROXSUITE_PRETTY_FUNCTION << "\n"; \
23 ss << "at line: " << __LINE__ << "\n"; \
24 ss << message << "\n"; \
25 throw exception(ss.str()); \
26 }
27
28#define PROXSUITE_CHECK_ARGUMENT_SIZE(size, expected_size, message) \
29 if (size != expected_size) { \
30 std::ostringstream oss; \
31 oss << "wrong argument size: expected " << expected_size << ", got " \
32 << size << "\n"; \
33 oss << "hint: " << message << std::endl; \
34 PROXSUITE_THROW_PRETTY(true, std::invalid_argument, oss.str()); \
35 }
36
37#if HEDLEY_MSVC_VERSION_CHECK(14, 0, 0) || \
38 HEDLEY_INTEL_CL_VERSION_CHECK(2021, 1, 0)
39#define VEG_DEPRECATED(Reason) __declspec(deprecated(Reason))
40#elif HEDLEY_HAS_EXTENSION(attribute_deprecated_with_message) || \
41 HEDLEY_GCC_VERSION_CHECK(4, 5, 0) || HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || \
42 HEDLEY_ARM_VERSION_CHECK(5, 6, 0) || \
43 HEDLEY_SUNPRO_VERSION_CHECK(5, 13, 0) || \
44 HEDLEY_PGI_VERSION_CHECK(17, 10, 0) || HEDLEY_TI_VERSION_CHECK(18, 1, 0) || \
45 HEDLEY_TI_ARMCL_VERSION_CHECK(18, 1, 0) || \
46 HEDLEY_TI_CL6X_VERSION_CHECK(8, 3, 0) || \
47 HEDLEY_TI_CL7X_VERSION_CHECK(1, 2, 0) || \
48 HEDLEY_TI_CLPRU_VERSION_CHECK(2, 3, 0)
49#define VEG_DEPRECATED(Reason) __attribute__((__deprecated__(Reason)))
50#elif defined(VEG_WITH_CXX14_SUPPORT)
51#define VEG_DEPRECATED(Reason) \
52 HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[deprecated(Reason)]])
53#elif HEDLEY_HAS_ATTRIBUTE(deprecated) || HEDLEY_GCC_VERSION_CHECK(3, 1, 0) || \
54 HEDLEY_ARM_VERSION_CHECK(4, 1, 0) || HEDLEY_TI_VERSION_CHECK(15, 12, 0) || \
55 (HEDLEY_TI_ARMCL_VERSION_CHECK(4, 8, 0) && \
56 defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
57 HEDLEY_TI_ARMCL_VERSION_CHECK(5, 2, 0) || \
58 (HEDLEY_TI_CL2000_VERSION_CHECK(6, 0, 0) && \
59 defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
60 HEDLEY_TI_CL2000_VERSION_CHECK(6, 4, 0) || \
61 (HEDLEY_TI_CL430_VERSION_CHECK(4, 0, 0) && \
62 defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
63 HEDLEY_TI_CL430_VERSION_CHECK(4, 3, 0) || \
64 (HEDLEY_TI_CL6X_VERSION_CHECK(7, 2, 0) && \
65 defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
66 HEDLEY_TI_CL6X_VERSION_CHECK(7, 5, 0) || \
67 HEDLEY_TI_CL7X_VERSION_CHECK(1, 2, 0) || \
68 HEDLEY_TI_CLPRU_VERSION_CHECK(2, 1, 0)
69#define VEG_DEPRECATED(Reason) __attribute__((__deprecated__))
70#elif HEDLEY_MSVC_VERSION_CHECK(13, 10, 0) || \
71 HEDLEY_PELLES_VERSION_CHECK(6, 50, 0) || \
72 HEDLEY_INTEL_CL_VERSION_CHECK(2021, 1, 0)
73#define VEG_DEPRECATED(Reason) __declspec(deprecated)
74#elif HEDLEY_IAR_VERSION_CHECK(8, 0, 0)
75#define VEG_DEPRECATED(Reason) _Pragma("deprecated")
76#else
77#define VEG_DEPRECATED(Reason)
78#endif
79
81#define VEG_UNUSED_VARIABLE(var) (void)(var)
82#ifdef NDEBUG
83#define VEG_ONLY_USED_FOR_DEBUG(var) VEG_UNUSED_VARIABLE(var)
84#else
85#define VEG_ONLY_USED_FOR_DEBUG(var)
86#endif
87
89
90#if defined(__clang__)
91#define VEG_WRAP_SILENCE_WARNING(...) \
92 HEDLEY_DIAGNOSTIC_PUSH _Pragma( \
93 "clang diagnostic ignored \"-Wc++17-extensions\"") \
94 __VA_ARGS__ HEDLEY_DIAGNOSTIC_POP
95#else
96#define VEG_WRAP_SILENCE_WARNING(...) __VA_ARGS__
97#endif
98
99#ifndef VEG_HAS_NO_UNIQUE_ADDRESS
100#define VEG_HAS_NO_UNIQUE_ADDRESS 0
101#endif
102
103#if VEG_HAS_NO_UNIQUE_ADDRESS
104#ifdef _MSC_VER
105#define VEG_NO_UNIQUE_ADDRESS [[msvc::no_unique_address]]
106#else
107#define VEG_NO_UNIQUE_ADDRESS [[no_unique_address]]
108#endif
109#else
110#define VEG_NO_UNIQUE_ADDRESS
111#endif
112
113#ifndef VEG_INLINE
114
115#if defined(NDEBUG) || defined(__OPTIMIZE__)
116#define VEG_INLINE HEDLEY_ALWAYS_INLINE
117#else
118#define VEG_INLINE inline
119#endif
120
121#endif
122
123#define VEG_NO_INLINE HEDLEY_NEVER_INLINE
124
125#if defined(__cpp_concepts) && __cpp_concepts >= 201907L
126#define VEG_HAS_CONCEPTS 1
127#else
128#define VEG_HAS_CONCEPTS 0
129#endif
130
131#define VEG_DECLVAL(...) (std::declval<__VA_ARGS__>())
132
133#if defined(__clang__)
134#define VEG_ARROW(...) \
135 __attribute__((always_inline)) noexcept(noexcept((__VA_ARGS__))) \
136 ->decltype((__VA_ARGS__)) \
137 { \
138 return __VA_ARGS__; \
139 }
140#elif defined(__GNUC__) && (__GNUC__ >= 9)
141#define VEG_ARROW(...) \
142 noexcept(noexcept((__VA_ARGS__))) __attribute__((always_inline)) \
143 ->decltype((__VA_ARGS__)) \
144 { \
145 return __VA_ARGS__; \
146 }
147#else
148#define VEG_ARROW(...) \
149 noexcept(noexcept((__VA_ARGS__)))->decltype((__VA_ARGS__)) \
150 { \
151 return __VA_ARGS__; \
152 }
153#endif
154
155#define VEG_LAZY_BY_REF(...) [&]() VEG_ARROW(__VA_ARGS__)
156
157#define VEG_LIFT(...) \
158 [&](auto&&... args) VEG_ARROW((__VA_ARGS__)(VEG_FWD(args)...))
159
160#define VEG_DEDUCE_RET(...) \
161 noexcept(noexcept(__VA_ARGS__))->decltype(__VA_ARGS__) \
162 { \
163 return __VA_ARGS__; \
164 } \
165 VEG_NOM_SEMICOLON
166
167#if defined(VEG_WITH_CXX17_SUPPORT)
168#define VEG_HAS_FOLD_EXPR 1
169#define VEG_ALL_OF(...) (__VA_ARGS__ && ... && true)
170#define VEG_ANY_OF(...) (__VA_ARGS__ || ... || false)
171#elif defined(__clang__)
172#define VEG_HAS_FOLD_EXPR 1
173#define VEG_ALL_OF(...) VEG_WRAP_SILENCE_WARNING((__VA_ARGS__ && ... && true))
174#define VEG_ANY_OF(...) VEG_WRAP_SILENCE_WARNING((__VA_ARGS__ || ... || false))
175#else
176#define VEG_HAS_FOLD_EXPR 0
177#define VEG_ALL_OF(...) \
178 ::proxsuite::linalg::veg::meta::and_test< \
179 ::proxsuite::linalg::veg::meta::make_index_sequence< \
180 ::proxsuite::linalg::veg::meta::pack_size<decltype(( \
181 void)(__VA_ARGS__))...>::value>, \
182 ::proxsuite::linalg::veg::meta::bool_constant<(__VA_ARGS__)>...>::value
183#define VEG_ANY_OF(...) \
184 ::proxsuite::linalg::veg::meta::or_test< \
185 ::proxsuite::linalg::veg::meta::make_index_sequence< \
186 ::proxsuite::linalg::veg::meta::pack_size<decltype(( \
187 void)(__VA_ARGS__))...>::value>, \
188 ::proxsuite::linalg::veg::meta::bool_constant<(__VA_ARGS__)>...>::value
189#endif
190
191#define VEG_EVAL_ALL(...) \
192 ((void)(::proxsuite::linalg::veg::_detail::EmptyArr{ \
193 ::proxsuite::linalg::veg::_detail::Empty{}, \
194 ((void)(__VA_ARGS__), ::proxsuite::linalg::veg::_detail::Empty{})... }))
195
197
198#if VEG_HAS_CONCEPTS
199
200#define __VEG_IMPL_AND(_, Param) &&__VEG_PP_UNWRAP(Param)
201#define __VEG_IMPL_OR(_, Param) || __VEG_PP_UNWRAP(Param)
202
203#define __VEG_IMPL_CONJUNCTION(First, ...) \
204 (__VEG_PP_UNWRAP(First) \
205 __VEG_PP_TUPLE_FOR_EACH(__VEG_IMPL_AND, _, (__VA_ARGS__)))
206
207#define __VEG_IMPL_DISJUNCTION(First, ...) \
208 (__VEG_PP_UNWRAP(First) \
209 __VEG_PP_TUPLE_FOR_EACH(__VEG_IMPL_OR, _, (__VA_ARGS__)))
210
211#define VEG_DEF_CONCEPT(Tpl, Name, ...) \
212 template<__VEG_PP_REMOVE_PAREN1(Tpl)> \
213 concept Name = __VA_ARGS__; \
214 VEG_NOM_SEMICOLON
215
216#define VEG_CHECK_CONCEPT_MACRO(Namespace, ...) \
217 static_assert(Namespace::__VA_ARGS__, \
218 __VEG_PP_STRINGIZE(__VA_ARGS__) " failed")
219#define VEG_CONCEPT_MACRO(Namespace, ...) Namespace::__VA_ARGS__
220
221#define VEG_DEF_CONCEPT_CONJUNCTION(Tpl, Name, Terms) \
222 VEG_DEF_CONCEPT(Tpl, Name, __VEG_IMPL_CONJUNCTION Terms)
223#define VEG_DEF_CONCEPT_DISJUNCTION(Tpl, Name, Terms) \
224 VEG_DEF_CONCEPT(Tpl, Name, __VEG_IMPL_DISJUNCTION Terms)
225
226#define VEG_CONCEPT_EXPR(Tpl, TplNames, Name, Expr, ...) \
227 namespace _veg_detail { \
228 template<typename ExprType, __VEG_PP_REMOVE_PAREN1(Tpl)> \
229 concept test_return_##Name = __VA_ARGS__; \
230 } \
231 template<__VEG_PP_REMOVE_PAREN1(Tpl)> \
232 concept Name = \
233 _veg_detail::test_return_##Name<decltype((Expr)), \
234 __VEG_PP_REMOVE_PAREN1(TplNames)>; \
235 template<__VEG_PP_REMOVE_PAREN1(Tpl)> \
236 concept xnothrow_##Name = noexcept(Expr); \
237 template<__VEG_PP_REMOVE_PAREN1(Tpl)> \
238 concept nothrow_##Name = noexcept(Expr); \
239 VEG_NOM_SEMICOLON
240
241#else
242
243#if defined(VEG_WITH_CXX14_SUPPORT)
244#define __VEG_IMPL_DEF_CONCEPT(Tpl, Name, Value, ...) \
245 namespace _ { \
246 template<__VEG_PP_REMOVE_PAREN1(Tpl)> \
247 struct Name : __VA_ARGS__ \
248 {}; \
249 } \
250 namespace { \
251 template<__VEG_PP_REMOVE_PAREN1(Tpl)> \
252 constexpr bool const& Name = \
253 ::proxsuite::linalg::veg::meta::bool_constant<Value>::value; \
254 } \
255 VEG_NOM_SEMICOLON
256#else
257#define __VEG_IMPL_DEF_CONCEPT(Tpl, Name, Value, ...) \
258 template<__VEG_PP_REMOVE_PAREN1(Tpl)> \
259 struct Name : __VA_ARGS__ \
260 {}
261#endif
262
263#ifdef __clang__
264#define __VEG_NO_WARNING_PRAGMA_PUSH \
265 HEDLEY_DIAGNOSTIC_PUSH _Pragma("clang diagnostic ignored \"-Wconversion\"")
266#define __VEG_NO_WARNING_PRAGMA_POP HEDLEY_DIAGNOSTIC_POP
267#else
268#define __VEG_NO_WARNING_PRAGMA_PUSH
269#define __VEG_NO_WARNING_PRAGMA_POP
270#endif
271
272#define VEG_CONCEPT_EXPR(Tpl, TplNames, Name, Expr, ...) \
273 namespace _veg_detail { \
274 template<typename _veg_Enable, __VEG_PP_REMOVE_PAREN1(Tpl)> \
275 struct test_sfinae_##Name \
276 { \
277 using TestExpr = ::proxsuite::linalg::veg::meta::false_type; \
278 using NothrowTestExpr = ::proxsuite::linalg::veg::meta::false_type; \
279 }; \
280 template<__VEG_PP_REMOVE_PAREN1(Tpl)> \
281 struct test_sfinae_##Name< \
282 ::proxsuite::linalg::veg::meta::void_t<decltype((Expr))>, \
283 __VEG_PP_REMOVE_PAREN1(TplNames)> \
284 { \
285 using ExprType = decltype((Expr)); \
286 using TestExpr = \
287 ::proxsuite::linalg::veg::meta::bool_constant<__VA_ARGS__>; \
288 using NothrowTestExpr = ::proxsuite::linalg::veg::meta::bool_constant< \
289 (TestExpr::value) && __VEG_NO_WARNING_PRAGMA_PUSH noexcept(Expr) \
290 __VEG_NO_WARNING_PRAGMA_POP>; \
291 }; \
292 } \
293 VEG_DEF_CONCEPT( \
294 Tpl, \
295 Name, \
296 _veg_detail::test_sfinae_##Name<void, __VEG_PP_REMOVE_PAREN1(TplNames)>:: \
297 TestExpr::value); \
298 VEG_DEF_CONCEPT(Tpl, nothrow_##Name, noexcept(Expr)); \
299 VEG_DEF_CONCEPT( \
300 Tpl, \
301 xnothrow_##Name, \
302 _veg_detail::test_sfinae_##Name<void, __VEG_PP_REMOVE_PAREN1(TplNames)>:: \
303 NothrowTestExpr::value); \
304 VEG_NOM_SEMICOLON
305
306#if defined(VEG_WITH_CXX14_SUPPORT)
307#define VEG_CONCEPT_MACRO(Namespace, ...) Namespace::__VA_ARGS__
308#define __VEG_IMPL_ADD_VALUE(I, _, Param) (Param)
309#define __VEG_IMPL_TRAIT(Param) __VEG_PP_HEAD Param _::__VEG_PP_TAIL Param
310#else
311#define VEG_CONCEPT_MACRO(Namespace, ...) Namespace::__VA_ARGS__::value
312#define __VEG_IMPL_ADD_VALUE(I, _, Param) \
313 ((__VEG_PP_REMOVE_PAREN(Param)::value))
314#define __VEG_IMPL_TRAIT(Param) __VEG_PP_UNWRAP(Param)
315#endif
316#define __VEG_IMPL_PUT_TRAIT(I, _, Param) __VEG_IMPL_TRAIT(Param)
317
318#define VEG_CHECK_CONCEPT_MACRO(Namespace, ...) \
319 static_assert(decltype(Namespace::check_##__VA_ARGS__())::value, \
320 __VEG_PP_STRINGIZE(__VA_ARGS__) " failed")
321#define VEG_DEF_CONCEPT(Tpl, Name, ...) \
322 __VEG_IMPL_DEF_CONCEPT( \
323 Tpl, \
324 Name, \
325 (__VA_ARGS__), \
326 ::proxsuite::linalg::veg::meta::bool_constant<__VA_ARGS__>); \
327 VEG_TEMPLATE( \
328 Tpl, \
329 requires(__VA_ARGS__), \
330 constexpr auto check_##Name, \
331 (_ = 0, int)) noexcept -> ::proxsuite::linalg::veg::meta::true_type
332
333#define __VEG_IMPL_SFINAE(_, Param) \
334 , ::proxsuite::linalg::veg::meta:: \
335 enable_if_t<__VEG_PP_ID(__VEG_PP_UNWRAP Param), int> = 0
336
337#define __VEG_IMPL_OVERLOAD(Name_Tpl, Param) \
338 template<__VEG_PP_REMOVE_PAREN(__VEG_PP_TAIL Name_Tpl), \
339 typename ::proxsuite::linalg::veg::_detail::_meta:: \
340 enable_if<__VEG_PP_ID(__VEG_PP_UNWRAP Param), int>::type = 0> \
341 auto __VEG_PP_CAT(check_, __VEG_PP_HEAD Name_Tpl)() noexcept \
342 -> ::proxsuite::linalg::veg::meta::true_type;
343
344#define VEG_DEF_CONCEPT_BOOL_CONJUNCTION_IMPL(Tpl, Name, Base, Seq) \
345 __VEG_IMPL_DEF_CONCEPT(Tpl, \
346 Name, \
347 (__VEG_PP_REMOVE_PAREN1(Base)::value), \
348 __VEG_PP_REMOVE_PAREN1(Base)); \
349 template<__VEG_PP_REMOVE_PAREN(Tpl) \
350 __VEG_PP_TUPLE_FOR_EACH(__VEG_IMPL_SFINAE, _, Seq)> \
351 auto check_##Name() noexcept -> ::proxsuite::linalg::veg::meta::true_type
352#define VEG_DEF_CONCEPT_BOOL_DISJUNCTION_IMPL(Tpl, Name, Base, Seq) \
353 __VEG_IMPL_DEF_CONCEPT(Tpl, \
354 Name, \
355 (__VEG_PP_REMOVE_PAREN1(Base)::value), \
356 __VEG_PP_REMOVE_PAREN1(Base)); \
357 __VEG_PP_TUPLE_FOR_EACH(__VEG_IMPL_OVERLOAD, (Name, Tpl), Seq) \
358 VEG_NOM_SEMICOLON
359
360#define VEG_DEF_CONCEPT_CONJUNCTION(Tpl, Name, Terms) \
361 VEG_DEF_CONCEPT_BOOL_CONJUNCTION_IMPL( \
362 Tpl, \
363 Name, \
364 (__VEG_IMPL_CONJUNCTION(Terms)), \
365 __VEG_PP_TUPLE_TRANSFORM_I(__VEG_IMPL_ADD_VALUE, _, Terms))
366
367#define VEG_DEF_CONCEPT_DISJUNCTION(Tpl, Name, Terms) \
368 VEG_DEF_CONCEPT_BOOL_DISJUNCTION_IMPL( \
369 Tpl, \
370 Name, \
371 (__VEG_IMPL_DISJUNCTION(Terms)), \
372 __VEG_PP_TUPLE_TRANSFORM_I(__VEG_IMPL_ADD_VALUE, _, Terms))
373
374#define __VEG_IMPL_CONJUNCTION(Tuple) \
375 ::proxsuite::linalg::veg::meta::conjunction<__VEG_PP_REMOVE_PAREN( \
376 __VEG_PP_TUPLE_TRANSFORM_I(__VEG_IMPL_PUT_TRAIT, _, Tuple))>
377#define __VEG_IMPL_DISJUNCTION(Tuple) \
378 ::proxsuite::linalg::veg::meta::disjunction<__VEG_PP_REMOVE_PAREN( \
379 __VEG_PP_TUPLE_TRANSFORM_I(__VEG_IMPL_PUT_TRAIT, _, Tuple))>
380
381#endif
382
384
385#define VEG_TEMPLATE(TParams, Constraint, Attr_Name, ...) \
386 __VEG_IMPL_TEMPLATE(Attr_Name, \
387 TParams, \
388 __VEG_PP_CAT2(__VEG_IMPL_PREFIX_, Constraint), \
389 __VA_ARGS__)
390
391#if VEG_HAS_CONCEPTS
392#define VEG_CONSTRAINED_MEMBER_FN(Constraint, Attr_Name, Params, ...) \
393 Attr_Name __VEG_PP_TUPLE_TRANSFORM_I(__VEG_IMPL_PARAM_EXPAND, _, Params) \
394 __VA_ARGS__ \
395 requires __VEG_PP_CAT2(__VEG_IMPL_PREFIX_, Constraint)
396
397#define VEG_TEMPLATE_CVT(TParams, Constraint, Attr, ...) \
398 template<__VEG_PP_REMOVE_PAREN(TParams)> \
399 Constraint Attr operator __VA_ARGS__()
400#else
401#define VEG_CONSTRAINED_MEMBER_FN(Constraint, Attr_Name, Params, ...) \
402 VEG_TEMPLATE( \
403 (int _ = 0), \
404 requires(__VEG_PP_CAT2(__VEG_IMPL_PREFIX_, Constraint) && \
405 ::proxsuite::linalg::veg::meta::bool_constant<(_ == 0)>::value), \
406 Attr_Name, \
407 __VEG_PP_REMOVE_PAREN(Params)) \
408 __VA_ARGS__
409
410#define VEG_TEMPLATE_CVT(TParams, Constraint, Attr, ...) \
411 template<__VEG_PP_REMOVE_PAREN(TParams)> \
412 Attr operator ::proxsuite::linalg::veg::meta::enable_if_t< \
413 (__VEG_PP_CAT2(__VEG_IMPL_PREFIX_, Constraint)), \
414 __VA_ARGS__>()
415#endif
416
417#if VEG_HAS_CONCEPTS && defined(__cpp_conditional_explicit) && \
418 (__cpp_conditional_explicit >= 201806L)
419#define VEG_TEMPLATE_EXPLICIT( \
420 TParams, Constraint, Explicit_Cond, Attr_Name, Params, ...) \
421 VEG_TEMPLATE(TParams, \
422 Constraint, \
423 Explicit_Cond Attr_Name, \
424 __VEG_PP_REMOVE_PAREN(Params)) \
425 __VA_ARGS__
426
427#define VEG_TEMPLATE_CVT_EXPLICIT( \
428 TParams, Constraint, Explicit_Cond, Attr, Type, ...) \
429 template<__VEG_PP_REMOVE_PAREN(TParams)> \
430 Constraint Explicit_Cond Attr operator __VEG_PP_REMOVE_PAREN(Type)() \
431 __VA_ARGS__
432
433#else
434#define VEG_TEMPLATE_EXPLICIT( \
435 TParams, Constraint, Explicit_Cond, Attr_Name, Params, ...) \
436 VEG_TEMPLATE( \
437 (__VEG_PP_REMOVE_PAREN TParams, \
438 ::proxsuite::linalg::veg::meta:: \
439 enable_if_t<(__VEG_PP_CAT2(__VEG_IMPL_PREFIX_, Explicit_Cond)), int> = \
440 0), \
441 Constraint, \
442 explicit Attr_Name, \
443 __VEG_PP_REMOVE_PAREN(Params)) \
444 __VA_ARGS__ \
445 VEG_TEMPLATE((__VEG_PP_REMOVE_PAREN TParams, \
446 ::proxsuite::linalg::veg::meta::enable_if_t< \
447 !(__VEG_PP_CAT2(__VEG_IMPL_PREFIX_, Explicit_Cond)), \
448 unsigned> = 0), \
449 Constraint, \
450 Attr_Name, \
451 __VEG_PP_REMOVE_PAREN(Params)) \
452 __VA_ARGS__
453
454#define VEG_TEMPLATE_CVT_EXPLICIT( \
455 TParams, Constraint, Explicit_Cond, Attr, Type, ...) \
456 VEG_TEMPLATE_CVT( \
457 (__VEG_PP_REMOVE_PAREN TParams, \
458 ::proxsuite::linalg::veg::meta:: \
459 enable_if_t<(__VEG_PP_CAT2(__VEG_IMPL_PREFIX_, Explicit_Cond)), int> = \
460 0), \
461 Constraint, \
462 explicit Attr, \
463 __VEG_PP_REMOVE_PAREN(Type)) \
464 __VA_ARGS__ \
465 \
466 VEG_TEMPLATE_CVT((__VEG_PP_REMOVE_PAREN TParams, \
467 ::proxsuite::linalg::veg::meta::enable_if_t< \
468 !(__VEG_PP_CAT2(__VEG_IMPL_PREFIX_, Explicit_Cond)), \
469 unsigned> = 0), \
470 Constraint, \
471 Attr, \
472 __VEG_PP_REMOVE_PAREN(Type)) \
473 __VA_ARGS__
474#endif
475
476#define __VEG_IMPL_PREFIX_requires
477#define __VEG_IMPL_PREFIX_explicit
478
479#define __VEG_IMPL_PARAM_EXPAND(I, _, Param) \
480 __VEG_PP_TAIL Param __VEG_PP_HEAD Param
481#if VEG_HAS_CONCEPTS
482#define __VEG_IMPL_TEMPLATE(Attr_Name, TParams, Constraint, ...) \
483 template<__VEG_PP_REMOVE_PAREN(TParams)> \
484 requires Constraint \
485 Attr_Name __VEG_PP_TUPLE_TRANSFORM_I( \
486 __VEG_IMPL_PARAM_EXPAND, _, (__VA_ARGS__))
487#else
488
489#define __VEG_IMPL_TEMPLATE2_HELPER_0(Constraint, Param) \
490 __VEG_PP_TAIL Param __VEG_PP_HEAD Param
491
492#define __VEG_IMPL_TEMPLATE2_HELPER_1(Constraint, Param) \
493 ::proxsuite::linalg::veg::meta::enable_if_t<(Constraint), \
494 __VEG_PP_TAIL Param> \
495 __VEG_PP_HEAD Param
496
497#define __VEG_IMPL_TEMPLATE2_HELPER(I, Constraint, Param) \
498 __VEG_PP_CAT2(__VEG_IMPL_TEMPLATE2_HELPER_, \
499 __VEG_IMPL_PP_IS_1(__VEG_IMPL_PP_INC(I))) \
500 (Constraint, Param)
501
502#define __VEG_IMPL_TEMPLATE(Attr_Name, TParams, Constraint, ...) \
503 template<__VEG_PP_REMOVE_PAREN(TParams)> \
504 Attr_Name __VEG_PP_TUPLE_TRANSFORM_I( \
505 __VEG_IMPL_TEMPLATE2_HELPER, Constraint, (__VA_ARGS__))
506
507#endif
508
510
511#if defined(VEG_WITH_CXX17_SUPPORT)
512#define VEG_INLINE_VAR(Name, Obj) \
513 inline constexpr auto const& Name = \
514 ::proxsuite::linalg::veg::meta::static_const<Obj>::value; \
515 static_assert((void(Name), true), ".")
516
517#define VEG_INLINE_VAR_TEMPLATE(Tpl, Name, ...) /* NOLINT */ \
518 template<__VEG_PP_REMOVE_PAREN(Tpl)> \
519 inline constexpr auto const& Name = \
520 ::proxsuite::linalg::veg::meta::static_const<__VA_ARGS__>::value; \
521 VEG_NOM_SEMICOLON /* NOLINT */
522#else
523#define VEG_INLINE_VAR(Name, Obj) \
524 namespace /* NOLINT */ { \
525 constexpr auto const& Name = \
526 ::proxsuite::linalg::veg::meta::static_const<Obj>::value; \
527 } \
528 static_assert((void(Name), true), ".")
529
530#if defined(VEG_WITH_CXX14_SUPPORT)
531#define VEG_INLINE_VAR_TEMPLATE(Tpl, Name, ...) /* NOLINT */ \
532 namespace /* NOLINT */ { /* NOLINT */ \
533 template<__VEG_PP_REMOVE_PAREN(Tpl)> \
534 constexpr auto const& Name = /* NOLINT */ \
535 ::proxsuite::linalg::veg::meta::static_const< \
536 __VA_ARGS__>::value; /* NOLINT \
537 */ \
538 } \
539 VEG_NOM_SEMICOLON /* NOLINT */
540#else
541#define VEG_INLINE_VAR_TEMPLATE(Tpl, Name, ...) VEG_NOM_SEMICOLON
542#endif
543#endif
544
545#define VEG_NIEBLOID(Name) VEG_INLINE_VAR(Name, nb::Name) // NOLINT
546
547#define VEG_NIEBLOID_TEMPLATE(Tpl, Name, ...) \
548 VEG_INLINE_VAR_TEMPLATE(Tpl, Name, nb::Name<__VA_ARGS__>) // NOLINT
549
550#define VEG_TAG(Name, Type) \
551 namespace _ { \
552 template<int I> \
553 struct Type \
554 { \
555 explicit Type() = default; \
556 }; \
557 } \
558 using Type = _::Type<0>; \
559 VEG_INLINE_VAR(Name, Type)
560
561#define VEG_TAG_TEMPLATE(Tpl, Name, Type, ...) \
562 template<__VEG_PP_REMOVE_PAREN(Tpl)> \
563 struct Type \
564 { \
565 explicit Type() = default; \
566 }; \
567 VEG_INLINE_VAR_TEMPLATE(Tpl, Name, Type<__VA_ARGS__>)
568
569#define VEG_FWD(X) static_cast<decltype(X)&&>(X)
570#define VEG_FWD2(X) static_cast<decltype(X)>(static_cast<decltype(X)&&>(X))
571
572// disallows moving const rvalues
573#define VEG_MOV(X) \
574 static_cast<typename ::proxsuite::linalg::veg::uncvref_t<decltype(X)>&&>(X)
575
576#ifdef VEG_NO_INSTANTIATE
577#define VEG_INSTANTIATE(Fn, ...) VEG_NOM_SEMICOLON
578#define VEG_INSTANTIATE_CLASS(Class, ...) VEG_NOM_SEMICOLON
579#else
580#define VEG_INSTANTIATE(Fn, ...) \
581 __VEG_IMPL_INSTANTIATE( \
582 Fn, \
583 __VEG_PP_CAT(__VEG_PP_CAT(_dummy_explicit_instantiation, __LINE__), \
584 __VEG_PP_CAT(_, __COUNTER__)), \
585 __VA_ARGS__)
586#define __VEG_IMPL_INSTANTIATE(Fn, Name, ...) \
587 template<typename... Ts> \
588 struct Name \
589 { \
590 void apply(Ts&&... args) \
591 { \
592 Fn(VEG_FWD(args)...); \
593 } \
594 }; \
595 template struct Name<__VA_ARGS__>
596
597#define VEG_INSTANTIATE_CLASS(Class, ...) template struct Class<__VA_ARGS__>
598#endif
599
600#define VEG_NOM_SEMICOLON static_assert(true, ".")
601#define VEG_ID(id) __VEG_PP_CAT(id, __COUNTER__)
602
603namespace proxsuite {
604namespace linalg {
605namespace veg {
606template<typename T>
607struct Slice;
608
609namespace meta {
610template<typename...>
611using void_t = void;
612} // namespace meta
613namespace _detail {
614template<typename T>
616{
618};
619namespace _meta {
620
621template<bool B, typename T = void>
623{
624 using type = T;
625};
626template<typename T>
629
630template<typename U, typename V>
632
633template<typename T>
634struct uncvlref;
635template<typename T>
637{
638 using type = T;
639};
640template<typename T>
642{
643 using type = T;
644};
645template<typename T>
647{
648 using type = T;
649};
650template<typename T>
652{
653 using type = T;
654};
655
656template<typename T>
657struct unref;
658template<typename T>
660{
661 using type = T;
662};
663
664} // namespace _meta
665} // namespace _detail
666
667namespace meta {
668template<typename T>
670{
671 static constexpr T value{};
672};
673
674template<typename T>
675constexpr T static_const<T>::value; // NOLINT(readability-redundant-declaration)
676} // namespace meta
677
678template<typename... Ts>
680
681template<typename... Types, typename... Args>
682auto
684template<typename... Types, typename... Args>
686VEG_CPP14(constexpr) void print_types(Args&&... /*unused*/)
687{
688}
689
690namespace nb {
691struct unused
692{
693 template<typename... Ts>
694 VEG_CPP14(constexpr)
695 void operator()(Ts const&... /*unused*/) const VEG_NOEXCEPT
696 {
697 }
698};
699} // namespace nb
701
702using usize = decltype(sizeof(0));
703namespace _detail {
704
705template<isize I>
706struct EmptyI
707{};
708
710using EmptyArr = Empty[];
711namespace _meta {
712
713template<typename T, T... Nums>
715
716#if VEG_HAS_BUILTIN(__make_integer_seq)
717
718template<typename T, T N>
720
721#elif __GNUC__ >= 8
722
723template<typename T, T N>
725
726#else
727
728namespace _detail {
729
730template<typename Seq1, typename Seq2>
731struct _merge;
732
733template<typename Seq1, typename Seq2>
735
736template<typename T, T... Nums1, T... Nums2>
738{
739 using type = integer_sequence<T, Nums1..., (sizeof...(Nums1) + Nums2)...>;
740};
741
742template<typename T, T... Nums1, T... Nums2>
744{
746 Nums1...,
747 (sizeof...(Nums1) + Nums2)...,
748 sizeof...(Nums1) + sizeof...(Nums2)>;
749};
750
751template<typename T, usize N, bool Even = (N % 2) == 0>
753{
754 using type =
755 typename _merge<typename _make_integer_sequence<T, N / 2>::type,
756 typename _make_integer_sequence<T, N / 2>::type>::type;
757};
758
759template<typename T, usize N>
761{
762 using type =
763 typename _merge_p1<typename _make_integer_sequence<T, N / 2>::type,
764 typename _make_integer_sequence<T, N / 2>::type>::type;
765};
766
767template<typename T>
769{
771};
772template<typename T>
777
778} // namespace _detail
779
780template<typename T, T N>
783
784#endif
785
786#define VEG_DEF_CONCEPT_BUILTIN_OR_INTERNAL(Tpl, Name, ...) \
787 VEG_DEF_CONCEPT( \
788 Tpl, \
789 Name, \
790 VEG_HAS_BUILTIN_OR(__is_##Name, \
791 __is_##Name(__VA_ARGS__), \
792 (_detail::_meta::is_##Name<__VA_ARGS__>::value)))
793
794template<usize N>
796
797template<typename... Ts>
799
800} // namespace _meta
801
802template<usize I, typename T>
804{
806};
807
808template<typename Seq, typename... Ts>
810
811template<usize... Is, typename... Ts>
812struct SimpleITuple<_meta::integer_sequence<usize, Is...>, Ts...>
813 : SimpleLeaf<Is, Ts>...
814{
815#if !defined(VEG_WITH_CXX17_SUPPORT)
816 constexpr SimpleITuple(Ts... args) noexcept
817 : SimpleLeaf<Is, Ts>{ Ts(VEG_FWD(args)) }...
818 {
819 }
820#endif
821};
822
823template<typename... Ts>
825 SimpleITuple<_meta::make_index_sequence<sizeof...(Ts)>, Ts...>;
826
827template<typename... Ts>
828constexpr auto
829make_simple_tuple(Empty /*dummy*/, Ts... args) noexcept -> SimpleTuple<Ts...>
830{
831#if !defined(VEG_WITH_CXX17_SUPPORT)
832 return { Ts(VEG_FWD(args))... };
833#else
834 return { { Ts(VEG_FWD(args)) }... };
835#endif
836}
837
838template<typename T>
840template<typename C, typename Mem>
841struct mem_ptr_type<Mem C::*>
842{
843 using Type = Mem;
844};
845
846constexpr auto
847all_of_slice(bool const* arr, usize size) VEG_NOEXCEPT -> bool
848{
849 return size == 0 ? true
850 : (arr[0] && _detail::all_of_slice(arr + 1, size - 1));
851}
852template<usize N>
853inline constexpr auto
854all_of(bool const (&lst)[N]) VEG_NOEXCEPT -> bool
855{
856 return _detail::all_of_slice(lst, N);
857}
858
859template<typename T>
861{
862 template<typename U, typename = U>
864 {
865 static constexpr bool value = false;
866 using Type = void;
867 };
868 template<typename U>
869 struct DetectImpl<U, typename U::_veglib_impl_member_extract::Type>
870 {
871 static constexpr bool value = true;
872 using Type = typename U::_veglib_impl_member_extract;
873 };
874
876 static constexpr bool value = Detect::value;
877 using Type = typename Detect::Type;
878};
879} // namespace _detail
880namespace meta {
881template<bool B, typename T = void>
884 T>;
885
886template<typename T>
888} // namespace meta
889using meta::uncvref_t;
890
891namespace meta {
892template<typename T, T Value>
894{
895 static constexpr T value = Value;
896};
897template<typename T, T Value>
898constexpr T constant<T, Value>::value;
899template<bool B>
901
904} // namespace meta
905namespace _detail {
906namespace _meta {
907
909{
910 static auto test(...) -> meta::false_type;
911};
912template<typename T>
914{
915 using wrapper_base::test;
917};
918template<typename T, typename U>
919using is_same = decltype(wrapper<T>::test(static_cast<wrapper<U>*>(nullptr)));
920} // namespace _meta
921} // namespace _detail
922namespace concepts {
923VEG_DEF_CONCEPT_BUILTIN_OR_INTERNAL((typename T, typename U), same, T, U);
924} // namespace concepts
925
926enum struct CharUnit : unsigned char
927{
928 SPACE = 0x20,
929 EXCLAMATION_MARK = 0x21,
930 DOUBLE_QUOTE = 0x22,
931 NUMBER = 0x23,
932 DOLLAR = 0x24,
933 PERCENT = 0x25,
934 AMPERSAND = 0x26,
935 SINGLE_QUOTE = 0x27,
936 LEFT_PARENTHESIS = 0x28,
937 RIGHT_PARENTHESIS = 0x29,
938 ASTERISK = 0x2A,
939 PLUS = 0x2B,
940 COMMA = 0x2C,
941 MINUS = 0x2D,
942 PERIOD = 0x2E,
943 SLASH = 0x2F,
944 ZERO = 0x30,
945 ONE = 0x31,
946 TWO = 0x32,
947 THREE = 0x33,
948 FOUR = 0x34,
949 FIVE = 0x35,
950 SIX = 0x36,
951 SEVEN = 0x37,
952 EIGHT = 0x38,
953 NINE = 0x39,
954 COLON = 0x3A,
955 SEMICOLON = 0x3B,
956 LESS_THAN = 0x3C,
957 EQUALITY_SIGN = 0x3D,
958 GREATER_THAN = 0x3E,
959 QUESTION_MARK = 0x3F,
960 AT_SIGN = 0x40,
961 UPPERCASE_A = 0x41,
962 UPPERCASE_B = 0x42,
963 UPPERCASE_C = 0x43,
964 UPPERCASE_D = 0x44,
965 UPPERCASE_E = 0x45,
966 UPPERCASE_F = 0x46,
967 UPPERCASE_G = 0x47,
968 UPPERCASE_H = 0x48,
969 UPPERCASE_I = 0x49,
970 UPPERCASE_J = 0x4A,
971 UPPERCASE_K = 0x4B,
972 UPPERCASE_L = 0x4C,
973 UPPERCASE_M = 0x4D,
974 UPPERCASE_N = 0x4E,
975 UPPERCASE_O = 0x4F,
976 UPPERCASE_P = 0x50,
977 UPPERCASE_Q = 0x51,
978 UPPERCASE_R = 0x52,
979 UPPERCASE_S = 0x53,
980 UPPERCASE_T = 0x54,
981 UPPERCASE_U = 0x55,
982 UPPERCASE_V = 0x56,
983 UPPERCASE_W = 0x57,
984 UPPERCASE_X = 0x58,
985 UPPERCASE_Y = 0x59,
986 UPPERCASE_Z = 0x5A,
987 LEFT_SQUARE_BRACKET = 0x5B,
988 BACKSLASH = 0x5C,
990 CARET = 0x5F,
991 GRAVE = 0x60,
992 LOWERCASE_A = 0x61,
993 LOWERCASE_B = 0x62,
994 LOWERCASE_C = 0x63,
995 LOWERCASE_D = 0x64,
996 LOWERCASE_E = 0x65,
997 LOWERCASE_F = 0x66,
998 LOWERCASE_G = 0x67,
999 LOWERCASE_H = 0x68,
1000 LOWERCASE_I = 0x69,
1001 LOWERCASE_J = 0x6A,
1002 LOWERCASE_K = 0x6B,
1003 LOWERCASE_L = 0x6C,
1004 LOWERCASE_M = 0x6D,
1005 LOWERCASE_N = 0x6E,
1006 LOWERCASE_O = 0x6F,
1007 LOWERCASE_P = 0x70,
1008 LOWERCASE_Q = 0x71,
1009 LOWERCASE_R = 0x72,
1010 LOWERCASE_S = 0x73,
1011 LOWERCASE_T = 0x74,
1012 LOWERCASE_U = 0x75,
1013 LOWERCASE_V = 0x76,
1014 LOWERCASE_W = 0x77,
1015 LOWERCASE_X = 0x78,
1016 LOWERCASE_Y = 0x79,
1017 LOWERCASE_Z = 0x7A,
1018 LEFT_CURLY_BRACKET = 0x7B,
1019 VERTICAL_BAR = 0x7C,
1020 RIGHT_CURLY_BRACKET = 0x7D,
1021 TILDE = 0x7E,
1022};
1023
1024inline namespace tags {
1025VEG_TAG(from_raw_parts, FromRawParts);
1026
1028VEG_TAG(unsafe, Unsafe);
1029} // namespace tags
1030
1031struct Str
1032{
1033private:
1034 struct
1035 {
1038 } _ = {};
1039
1040public:
1041 VEG_INLINE constexpr Str(Unsafe /*unsafe*/,
1042 FromRawParts /*from_raw_parts*/,
1043 CharUnit const* ptr,
1045 : _{ ptr, len } {};
1047};
1048
1051{
1052private:
1053 static constexpr CharUnit literal[sizeof...(Cs)] = { Cs... };
1054
1055public:
1058 {
1059 return { unsafe, from_raw_parts, literal, isize{ sizeof...(Cs) } };
1060 }
1061};
1062
1063template<CharUnit... Cs>
1064constexpr CharUnit StrLiteralConstant<Cs...>::literal[sizeof...(Cs)];
1065
1066namespace _detail {
1067using NativeChar8 = meta::uncvref_t<decltype(u8""[0])>;
1068
1069template<typename T, usize N>
1071{
1072 T _[N];
1073};
1074template<typename T>
1075constexpr auto
1077{
1078 static_assert(sizeof(T) != 0, ".");
1079 return true;
1080}
1081} // namespace _detail
1082} // namespace veg
1083} // namespace linalg
1084} // namespace proxsuite
1085
1086#if defined(__clang__) || (defined(VEG_WITH_CXX14_SUPPORT) && defined(__GNUC__))
1088#pragma GCC diagnostic ignored "-Wpedantic"
1089#ifdef __clang__
1090#pragma clang diagnostic ignored "-Wgnu-string-literal-operator-template"
1091#endif
1092
1093template<typename Char,
1094 Char... Cs>
1095constexpr auto
1096operator""__veglib_const_literal_gnuc() noexcept // NOLINT
1097 -> proxsuite::linalg::veg::StrLiteralConstant<
1098 proxsuite::linalg::veg::CharUnit(Cs)...>
1099{
1100 return {};
1101}
1102
1104
1105#define __VEG_IMPL_UTF8_CONST(Literal) /* NOLINT */ \
1106 (u8##Literal##__veglib_const_literal_gnuc)
1107
1108#elif (defined(__clang__) && defined(VEG_WITH_CXX20_SUPPORT)) || \
1109 (defined(__cpp_nontype_template_args) && \
1110 (__cpp_nontype_template_args >= 201911L))
1111namespace proxsuite {
1112namespace linalg {
1113namespace veg {
1114namespace _detail {
1115template<isize N>
1116struct StrLiteralImpl
1117{
1119
1120 template<typename Char>
1121 constexpr StrLiteralImpl(Char const* s)
1122 {
1123 for (isize i = 0; i < N; ++i) {
1125 }
1126 }
1127};
1128template<typename Char, isize N>
1129StrLiteralImpl(Char const (&)[N]) -> StrLiteralImpl<N - 1>;
1130
1131template<typename T>
1132struct StrLiteralLen;
1133
1134template<isize N>
1135struct StrLiteralLen<StrLiteralImpl<N>>
1136{
1137 static constexpr usize value{ N };
1138};
1139template<isize N>
1140struct StrLiteralLen<StrLiteralImpl<N> const>
1141{
1142 static constexpr usize value{ N };
1143};
1144
1145template<typename Seq, auto Literal>
1146struct StrLiteralExpand;
1147
1148template<usize... Is, StrLiteralImpl<static_cast<isize>(sizeof...(Is))> L>
1149struct StrLiteralExpand<_meta::integer_sequence<usize, Is...>, L>
1150{
1151 using Type = StrLiteralConstant<L._[Is]...>;
1152};
1153} // namespace _detail
1154} // namespace veg
1155} // namespace linalg
1156} // namespace proxsuite
1157
1158template<proxsuite::linalg::veg::_detail::StrLiteralImpl S>
1159constexpr auto
1160operator""__veglib_const_literal_cpp20() noexcept ->
1161 typename proxsuite::linalg::veg::_detail::StrLiteralExpand< //
1162 proxsuite::linalg::veg::_detail::_meta::make_index_sequence<
1163 proxsuite::linalg::veg::_detail::StrLiteralLen<decltype(S)>::value>,
1164 S>::Type
1165{
1166 return {};
1167}
1168#define __VEG_IMPL_UTF8_CONST(Literal) \
1169 (u8##Literal##__veglib_const_literal_cpp20)
1170
1171#else
1172
1173namespace proxsuite {
1174namespace linalg {
1175namespace veg {
1176namespace _detail {
1177
1178template<typename LiteralType, typename Seq>
1180
1181template<typename LiteralType, usize... Is>
1182struct ExtractCharsImpl<LiteralType, _meta::integer_sequence<usize, Is...>>
1183{
1184 using Type = StrLiteralConstant<CharUnit(LiteralType::value[Is])...>;
1185};
1186
1187template<typename LiteralType, typename Seq>
1189
1190template<typename LiteralType, usize... Is>
1191struct ExtractCharsImplExpr<LiteralType, _meta::integer_sequence<usize, Is...>>
1192{
1193 using Type = StrLiteralConstant<CharUnit(LiteralType::value()[Is])...>;
1194};
1195
1196template<typename LiteralType>
1197auto
1199 typename ExtractCharsImpl<
1202{
1203 return {};
1204}
1205
1206template<typename LiteralType>
1207auto
1209 typename ExtractCharsImplExpr<
1212{
1213 return {};
1214}
1215} // namespace _detail
1216} // namespace veg
1217} // namespace linalg
1218} // namespace proxsuite
1219
1220#define __VEG_IMPL_UTF8_CONST(Literal) \
1221 (::proxsuite::linalg::veg::_detail::extract_chars_expr( \
1222 []() /* NOLINT */ noexcept { \
1223 struct __VEG_PP_CAT(_veglib_type, __LINE__) \
1224 { \
1225 static constexpr auto value() noexcept -> decltype(Literal) \
1226 { \
1227 return Literal; \
1228 } \
1229 using Size = ::proxsuite::linalg::veg::meta::constant< \
1230 ::proxsuite::linalg::veg::usize, \
1231 sizeof(value()) / sizeof(value()[0]) - 1>; \
1232 }; \
1233 return __VEG_PP_CAT(_veglib_type, __LINE__){}; \
1234 }()))
1235#endif
1236
1237#define VEG_DECLTYPE_VOID(...) decltype(void(__VA_ARGS__))
1238#define VEG_BOOL_NOEXCEPT(...) \
1239 ::proxsuite::linalg::veg::meta::bool_constant<noexcept(__VA_ARGS__)>
1240
1241#define VEG_CHECK_CONCEPT(...) \
1242 VEG_CHECK_CONCEPT_MACRO(::proxsuite::linalg::veg::concepts, __VA_ARGS__)
1243#define VEG_CONCEPT(...) \
1244 VEG_CONCEPT_MACRO(::proxsuite::linalg::veg::concepts, __VA_ARGS__)
1245
1246#define __VEG_IMPL_GET_MEMBER_PTR(_, MemberPtr) /* NOLINT */ , &Type::MemberPtr
1247#define __VEG_IMPL_GET_MEMBER_NAME_PTR(_, MemberPtr) /* NOLINT */ \
1248 static_cast<::proxsuite::linalg::veg::_detail::NativeChar8 const*>( \
1249 __VEG_PP_CAT(u8, __VEG_PP_STRINGIZE(MemberPtr))),
1250#define __VEG_IMPL_GET_MEMBER_NAME_LEN(_, MemberPtr) /* NOLINT */ \
1251 (sizeof(__VEG_PP_CAT(u8, __VEG_PP_STRINGIZE(MemberPtr))) - 1),
1252
1253#define __VEG_IMPL_STRUCT_SETUP(PClass, ...) /* NOLINT */ \
1254 void _veg_lib_name_test()&& noexcept \
1255 { \
1256 static_assert( \
1257 VEG_CONCEPT(same<decltype(this), __VEG_PP_REMOVE_PAREN(PClass)*>), \
1258 "struct mismatch in VEG_REFLECT"); \
1259 } \
1260 struct _veglib_impl_member_extract \
1261 { \
1262 using Type = __VEG_PP_REMOVE_PAREN(PClass); \
1263 using MemberTuple = \
1264 decltype(::proxsuite::linalg::veg::_detail::make_simple_tuple( \
1265 ::proxsuite::linalg::veg::_detail::Empty { \
1266 } __VEG_PP_TUPLE_FOR_EACH(__VEG_IMPL_GET_MEMBER_PTR, \
1267 _, \
1268 (__VA_ARGS__)))); \
1269 static constexpr auto member_pointers() noexcept -> MemberTuple \
1270 { \
1271 return ::proxsuite::linalg::veg::_detail::make_simple_tuple( \
1272 ::proxsuite::linalg::veg::_detail::Empty {} __VEG_PP_TUPLE_FOR_EACH( \
1273 __VEG_IMPL_GET_MEMBER_PTR, _, (__VA_ARGS__))); \
1274 } \
1275 static constexpr auto class_name_ptr() noexcept \
1276 -> ::proxsuite::linalg::veg::_detail::NativeChar8 const* \
1277 { \
1278 return __VEG_PP_CAT(u8, \
1279 __VEG_PP_STRINGIZE(__VEG_PP_REMOVE_PAREN(PClass))); \
1280 } \
1281 static constexpr auto class_name_len() noexcept \
1282 -> ::proxsuite::linalg::veg::usize \
1283 { \
1284 return sizeof(__VEG_PP_CAT( \
1285 u8, __VEG_PP_STRINGIZE(__VEG_PP_REMOVE_PAREN(PClass)))) - \
1286 1; \
1287 } \
1288 static constexpr auto member_name_ptrs() noexcept \
1289 -> ::proxsuite::linalg::veg::_detail::Array_< \
1290 ::proxsuite::linalg::veg::_detail::NativeChar8 const*, \
1291 __VEG_PP_TUPLE_SIZE((__VA_ARGS__))> \
1292 { \
1293 return { { __VEG_PP_TUPLE_FOR_EACH( \
1294 __VEG_IMPL_GET_MEMBER_NAME_PTR, _, (__VA_ARGS__)) } }; \
1295 } \
1296 static constexpr auto member_name_lens() noexcept \
1297 -> ::proxsuite::linalg::veg::_detail::Array_< \
1298 ::proxsuite::linalg::veg::usize, \
1299 __VEG_PP_TUPLE_SIZE((__VA_ARGS__))> \
1300 { \
1301 return { { __VEG_PP_TUPLE_FOR_EACH( \
1302 __VEG_IMPL_GET_MEMBER_NAME_LEN, _, (__VA_ARGS__)) } }; \
1303 } \
1304 }; \
1305 friend struct ::proxsuite::linalg::veg::_detail::member_extract_access< \
1306 __VEG_PP_REMOVE_PAREN(PClass)>; \
1307 VEG_NOM_SEMICOLON
1308
1309#define VEG_REFLECT(PClass, ...) __VEG_IMPL_STRUCT_SETUP(PClass, __VA_ARGS__)
1310
1312#endif /* end of include guard VEG_MACROS_HPP_HSTLSKZXS */
#define HEDLEY_DIAGNOSTIC_PUSH
#define HEDLEY_DIAGNOSTIC_POP
#define VEG_DEF_CONCEPT_BUILTIN_OR_INTERNAL(Tpl, Name,...)
Definition macros.hpp:786
#define VEG_TAG(Name, Type)
Definition macros.hpp:550
#define VEG_NIEBLOID(Name)
Definition macros.hpp:545
#define VEG_DEPRECATED(Reason)
Definition macros.hpp:77
#define VEG_INLINE
Definition macros.hpp:118
#define VEG_FWD(X)
Definition macros.hpp:569
decltype(wrapper< T >::test(static_cast< wrapper< U > * >(nullptr))) is_same
Definition macros.hpp:919
meta::uncvref_t< decltype(u8""[0])> NativeChar8
Definition macros.hpp:1067
auto extract_chars_expr(LiteralType) -> typename ExtractCharsImplExpr< LiteralType, _meta::make_index_sequence< LiteralType::Size::value > >::Type
Definition macros.hpp:1208
constexpr auto all_of(bool const (&lst)[N]) VEG_NOEXCEPT -> bool
Definition macros.hpp:854
constexpr auto assert_complete() noexcept -> bool
Definition macros.hpp:1076
auto extract_chars(LiteralType) -> typename ExtractCharsImpl< LiteralType, _meta::make_index_sequence< LiteralType::Size::value > >::Type
Definition macros.hpp:1198
constexpr auto all_of_slice(bool const *arr, usize size) VEG_NOEXCEPT -> bool
Definition macros.hpp:847
constexpr auto make_simple_tuple(Empty, Ts... args) noexcept -> SimpleTuple< Ts... >
Definition macros.hpp:829
typename _detail::_meta::uncvlref< T & >::type uncvref_t
Definition macros.hpp:887
_detail::_meta::integer_sequence< T, Nums... > * integer_sequence
_detail::_meta::make_integer_sequence< T, N > * make_integer_sequence
_detail::_meta::make_integer_sequence< usize, N > * make_index_sequence
bool_constant< false > false_type
Definition macros.hpp:903
bool_constant< true > true_type
Definition macros.hpp:902
auto print_types_halt(Args &&...) -> incomplete_t< Types..., Args... >
_detail::_meta::make_signed< usize >::Type isize
Definition typedefs.hpp:43
decltype(sizeof(0)) usize
Definition macros.hpp:702
#define VEG_NOEXCEPT
Definition prologue.hpp:30
#define VEG_CPP14(...)
Definition prologue.hpp:71
VEG_INLINE constexpr auto as_slice() const noexcept -> Slice< CharUnit >
VEG_INLINE constexpr auto as_slice() const noexcept -> Slice< CharUnit >
VEG_INLINE constexpr Str(Unsafe, FromRawParts, CharUnit const *ptr, isize len) noexcept
Definition macros.hpp:1041
typename _merge_p1< typename _make_integer_sequence< T, N/2 >::type, typename _make_integer_sequence< T, N/2 >::type >::type type
Definition macros.hpp:762
typename _merge< typename _make_integer_sequence< T, N/2 >::type, typename _make_integer_sequence< T, N/2 >::type >::type type
Definition macros.hpp:754
static auto test(...) -> meta::false_type
static auto test(wrapper< T > *) -> meta::true_type