Introduce a better syntax for single resource allocation

This commit is contained in:
bʰedoh₂ swé 2025-07-27 22:51:39 +05:00
parent 40f67b4bd7
commit 1fdb80e633

View File

@ -14,7 +14,7 @@
#endif
#define WITH99_MAJOR 2
#define WITH99_MINOR 0
#define WITH99_MINOR 1
#define WITH99_PATCH 0
#define WITH99_VERSION_COMPATIBLE(x, y, z) (WITH99_MAJOR == (x) && ((WITH99_MINOR == (y) && WITH99_PATCH >= (z)) || (WITH99_MINOR > (y))))
@ -55,7 +55,19 @@
#define WITH99_With(...) ML99_EVAL(WITH99_with(v(__VA_ARGS__)))
#define WITH99_priv_multiple(...) ML99_variadicsForEach(v(WITH99_priv_create_stmt), v(__VA_ARGS__))
#define WITH99_with(...) ML99_call(WITH99_with, __VA_ARGS__)
#define WITH99_with_IMPL(...) ML99_variadicsForEach(v(WITH99_priv_create_stmt), v(__VA_ARGS__))
#define WITH99_with_IMPL(...) \
ML99_appl(\
ML99_if(\
ML99_isTuple(ML99_variadicsGet(0)(v(__VA_ARGS__))),\
ML99_compose(ML99_appl(v(ML99_variadicsForEach), v(WITH99_priv_create_stmt)), v(ML99_untuple)),\
v(WITH99_priv_create_stmt)\
),\
ML99_tuple(v(__VA_ARGS__))\
)
#endif