diff options
author | olpc user <olpc@xo-5d-f7-86.localdomain> | 2019-12-09 02:10:46 -0800 |
---|---|---|
committer | olpc user <olpc@xo-5d-f7-86.localdomain> | 2019-12-09 02:10:46 -0800 |
commit | 5ef775d2612ad98b58c6cf8396adac35e883910d (patch) | |
tree | d26380e46100936b2ee219739843d79e14bbda1e /starts | |
parent | b88421a06828653ac551ded68e6c163dff41ec37 (diff) | |
download | standingwithresilience-5ef775d2612ad98b58c6cf8396adac35e883910d.tar.gz standingwithresilience-5ef775d2612ad98b58c6cf8396adac35e883910d.zip |
add iteration macro to open syntax sugar options
Diffstat (limited to 'starts')
-rw-r--r-- | starts/meaning-vm/level-0/common.hpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/starts/meaning-vm/level-0/common.hpp b/starts/meaning-vm/level-0/common.hpp index 6e86907..613028d 100644 --- a/starts/meaning-vm/level-0/common.hpp +++ b/starts/meaning-vm/level-0/common.hpp @@ -2,6 +2,25 @@ #define self (*this) +// macro argument iteration, from stackoverflow.com/questions/1872220 +#define _macro_for_each(funcormacro,...) \ + _macro_fe_get(__VA_ARGS__, \ + _macro_fe_9,_macro_fe_8,_macro_fe_7,_macro_fe_6,_macro_fe_5,_macro_fe_4,_macro_fe_3,_macro_fe_2,_macro_fe_1,_macro_fe_0 \ + )(funcormacro,__VA_ARGS__) + #define _macro_fe_0(what, x, ...) what(x) + #define _macro_fe_1(what, x, ...) what(x)fe_0(what, __VA_ARGS__) + #define _macro_fe_2(what, x, ...) what(x)fe_1(what, __VA_ARGS__) + #define _macro_fe_3(what, x, ...) what(x)fe_2(what, __VA_ARGS__) + #define _macro_fe_4(what, x, ...) what(x)fe_3(what, __VA_ARGS__) + #define _macro_fe_5(what, x, ...) what(x)fe_4(what, __VA_ARGS__) + #define _macro_fe_6(what, x, ...) what(x)fe_5(what, __VA_ARGS__) + #define _macro_fe_7(what, x, ...) what(x)fe_6(what, __VA_ARGS__) + #define _macro_fe_8(what, x, ...) what(x)fe_7(what, __VA_ARGS__) + #define _macro_fe_9(what, x, ...) what(x)fe_8(what, __VA_ARGS__) + #define _macro_fe_get( \ + _0,_1,_2,_3,_4,_5,_6,_7,_8,_9, \ + name,...) name + namespace intellect { namespace level0 { |