Metalang99 1.13.3
Full-blown preprocessor metaprogramming
|
Variadic arguments: x, y, z
.
More...
Go to the source code of this file.
Macros | |
#define | ML99_variadicsCount(...) ML99_call(ML99_variadicsCount, __VA_ARGS__) |
Computes a count of its arguments. More... | |
#define | ML99_variadicsIsSingle(...) ML99_call(ML99_variadicsIsSingle, __VA_ARGS__) |
Tells if it received only one argument or not. More... | |
#define | ML99_variadicsGet(i) ML99_PRIV_CAT(ML99_PRIV_variadicsGet_, i) |
Expands to a metafunction extracting the i -indexed argument. More... | |
#define | ML99_variadicsTail(...) ML99_call(ML99_variadicsTail, __VA_ARGS__) |
Extracts the tail of its arguments. More... | |
#define | ML99_variadicsForEach(f, ...) ML99_call(ML99_variadicsForEach, f, __VA_ARGS__) |
Applies f to each argument. More... | |
#define | ML99_variadicsForEachI(f, ...) ML99_call(ML99_variadicsForEachI, f, __VA_ARGS__) |
Applies f to each argument with an index. More... | |
#define | ML99_OVERLOAD(f, ...) ML99_PRIV_CAT(f, ML99_PRIV_VARIADICS_COUNT(__VA_ARGS__))(__VA_ARGS__) |
Overloads f on a number of arguments. More... | |
#define | ML99_VARIADICS_COUNT(...) ML99_PRIV_VARIADICS_COUNT(__VA_ARGS__) |
#define | ML99_VARIADICS_IS_SINGLE(...) ML99_PRIV_NOT(ML99_PRIV_CONTAINS_COMMA(__VA_ARGS__)) |
#define | ML99_VARIADICS_GET(i) ML99_PRIV_CAT(ML99_PRIV_VARIADICS_GET_, i) |
#define | ML99_VARIADICS_TAIL(...) ML99_PRIV_TAIL(__VA_ARGS__) |
Variadic arguments: x, y, z
.
#define ML99_OVERLOAD | ( | f, | |
... | |||
) | ML99_PRIV_CAT(f, ML99_PRIV_VARIADICS_COUNT(__VA_ARGS__))(__VA_ARGS__) |
Overloads f
on a number of arguments.
This function counts the number of provided arguments, appends it to f
and calls the resulting macro identifier with provided arguments.
At most 63 variadic arguments are acceptable.
f
need not be postfixed with _IMPL
. It is literally invoked as ML99_CAT(f,
ML99_VARIADICS_COUNT(...))(...)
. #define ML99_variadicsCount | ( | ... | ) | ML99_call(ML99_variadicsCount, __VA_ARGS__) |
Computes a count of its arguments.
At most 63 arguments are acceptable.
#define ML99_variadicsForEach | ( | f, | |
... | |||
) | ML99_call(ML99_variadicsForEach, f, __VA_ARGS__) |
Applies f
to each argument.
The result is ML99_appl(f, x1) ... ML99_appl(f, xN)
.
#define ML99_variadicsForEachI | ( | f, | |
... | |||
) | ML99_call(ML99_variadicsForEachI, f, __VA_ARGS__) |
Applies f
to each argument with an index.
The result is ML99_appl2(f, x1, 0) ... ML99_appl2(f, xN, N - 1)
.
#define ML99_variadicsGet | ( | i | ) | ML99_PRIV_CAT(ML99_PRIV_variadicsGet_, i) |
Expands to a metafunction extracting the i
-indexed argument.
i
can range from 0 to 7, inclusively.
#define ML99_variadicsIsSingle | ( | ... | ) | ML99_call(ML99_variadicsIsSingle, __VA_ARGS__) |
Tells if it received only one argument or not.
#define ML99_variadicsTail | ( | ... | ) | ML99_call(ML99_variadicsTail, __VA_ARGS__) |
Extracts the tail of its arguments.
At least two arguments must be specified.