Skip to content

Commit

Permalink
fixed calculation of number of arguments
Browse files Browse the repository at this point in the history
now available counting from zero args
  • Loading branch information
svhelper committed Sep 8, 2018
1 parent 2e097e0 commit 9ced5b9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions aprinter/base/Preprocessor_MacroMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@

// This is made to be included from Preprocessor.h, don't include directly.

#define APRINTER_AS_NUM_MACRO_ARGS(...) APRINTER_AS_NUM_MACRO_ARGS_HELPER1(__VA_ARGS__, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)
#define APRINTER_AS_NUM_MACRO_ARGS_HELPER1(...) APRINTER_AS_NUM_MACRO_ARGS_HELPER2(__VA_ARGS__)
#define APRINTER_AS_NUM_MACRO_ARGS_HELPER2(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, N, ...) N
#define APRINTER_AS_NUM_MACRO_ARGS(...) APRINTER_AS_NUM_MACRO_ARGS_HELPER1(-1, ##__VA_ARGS__, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)
#define APRINTER_AS_NUM_MACRO_ARGS_HELPER1(_dummy, ...) APRINTER_AS_NUM_MACRO_ARGS_HELPER2(_dummy, ##__VA_ARGS__)
#define APRINTER_AS_NUM_MACRO_ARGS_HELPER2(_dummy, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, N, ...) N

#define APRINTER_NUM_TUPLE_ARGS(tuple) APRINTER_AS_NUM_MACRO_ARGS tuple

Expand Down

0 comments on commit 9ced5b9

Please sign in to comment.