1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
#define func(args...) func_x(, ##args, func_3(args), func_2(args), func_1(args), func_0())
#define func_x(x, A, B, C, Func, ...) Func
#define func_VA(args...) std::cout << #args << std::endl
#define func_0() std::cout << "0" << std::endl;
#define func_1(A1) func_VA(A1)
#define func_2(A1, A2) func_1(A1), func_VA(A2)
#define func_3(A1, A2, A3) func_2(A1, A2), func_VA(A3)
func();
func(1);
func(1, 2);
func(1, 2, 3);
// Does not work unless func((std::vector<int>{0,1,2,3,4}));
func(std::vector<int>{0,1,2,3,4});
|