Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

utilize __VA_OPT__ #11

Open
nopeslide opened this issue Nov 21, 2020 · 1 comment
Open

utilize __VA_OPT__ #11

nopeslide opened this issue Nov 21, 2020 · 1 comment

Comments

@nopeslide
Copy link

when using __VA_OPT__ you can make this even more compact

#define EVAL0(...) __VA_ARGS__
#define EVAL1(...) EVAL0( EVAL0 ( EVAL0 ( __VA_ARGS__ )))
#define EVAL2(...) EVAL1( EVAL1 ( EVAL1 ( __VA_ARGS__ )))
#define EVAL3(...) EVAL2( EVAL2 ( EVAL2 ( __VA_ARGS__ )))
#define EVAL4(...) EVAL3( EVAL3 ( EVAL3 ( __VA_ARGS__ )))
#define EVAL(...) EVAL4(__VA_ARGS__)

#define NOP
#define MAP_POP0(F,X,...) F(X) __VA_OPT__(MAP_POP1 NOP (F,__VA_ARGS__))
#define MAP_POP1(F,X,...) F(X) __VA_OPT__(MAP_POP0 NOP (F,__VA_ARGS__))

#define MAP(F,...) __VA_OPT__(EVAL (MAP_POP0(F, __VA_ARGS__)))


MAP(F,1,2,3,4,5,6,7,8,9,10)
@nopeslide
Copy link
Author

this also fixes #9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant