|
@@ -480,3 +480,14 @@
|
480
|
480
|
#define RREPEAT(N,OP) RREPEAT_S(0,N,OP)
|
481
|
481
|
#define RREPEAT2_S(S,N,OP,V...) EVAL1024(_RREPEAT2(S,SUB##S(N),OP,V))
|
482
|
482
|
#define RREPEAT2(N,OP,V...) RREPEAT2_S(0,N,OP,V)
|
|
483
|
+
|
|
484
|
+// See https://github.com/swansontec/map-macro
|
|
485
|
+#define MAP_OUT
|
|
486
|
+#define MAP_END(...)
|
|
487
|
+#define MAP_GET_END() 0, MAP_END
|
|
488
|
+#define MAP_NEXT0(test, next, ...) next MAP_OUT
|
|
489
|
+#define MAP_NEXT1(test, next) MAP_NEXT0 (test, next, 0)
|
|
490
|
+#define MAP_NEXT(test, next) MAP_NEXT1 (MAP_GET_END test, next)
|
|
491
|
+#define MAP0(f, x, peek, ...) f(x) MAP_NEXT (peek, MAP1) (f, peek, __VA_ARGS__)
|
|
492
|
+#define MAP1(f, x, peek, ...) f(x) MAP_NEXT (peek, MAP0) (f, peek, __VA_ARGS__)
|
|
493
|
+#define MAP(f, ...) EVAL512 (MAP1 (f, __VA_ARGS__, (), 0))
|