- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
//--------------------------------------------------------------------------
#define DEF_P(X, Y, N) X##N
#define DEF_D(X, Y, N) X##N Y##N
#define DP1(DT, X, Y) DT(X, Y, 0)
//--------------------------------------------------------------------------
#define DP2(DT, X, Y) DP1(DT, X, Y), DT(X, Y, 1)
#define DP3(DT, X, Y) DP2(DT, X, Y), DT(X, Y, 2)
#define DP4(DT, X, Y) DP3(DT, X, Y), DT(X, Y, 3)
#define DP5(DT, X, Y) DP4(DT, X, Y), DT(X, Y, 4)
#define DP6(DT, X, Y) DP5(DT, X, Y), DT(X, Y, 5)
#define DP7(DT, X, Y) DP6(DT, X, Y), DT(X, Y, 6)
#define DP8(DT, X, Y) DP7(DT, X, Y), DT(X, Y, 7)
#define DP9(DT, X, Y) DP8(DT, X, Y), DT(X, Y, 8)
#define DP10(DT, X, Y) DP9(DT, X, Y), DT(X, Y, 9)
#define DP11(DT, X, Y) DP10(DT, X, Y), DT(X, Y, 10)
#define DP12(DT, X, Y) DP11(DT, X, Y), DT(X, Y, 11)
#define DP13(DT, X, Y) DP12(DT, X, Y), DT(X, Y, 12)
#define DP14(DT, X, Y) DP13(DT, X, Y), DT(X, Y, 13)
#define DP15(DT, X, Y) DP14(DT, X, Y), DT(X, Y, 14)
//--------------------------------------------------------------------------
// define functor for params count 0
//--------------------------------------------------------------------------
#define TEMP_DEF_PARAM(N)
#define TEMP_SPC_PARAM(N)
#define FUNC_PTR_PARAM(N)
#define FUNC_INV_PARAM(N)
#define FUNC_DEF_PARAM(N)
DEFINE_FUNCTOR(0);
#undef TEMP_DEF_PARAM
#undef TEMP_SPC_PARAM
#undef FUNC_PTR_PARAM
#undef FUNC_INV_PARAM
#undef FUNC_DEF_PARAM
//--------------------------------------------------------------------------
// define functor for other params counts
//--------------------------------------------------------------------------
#define TEMP_DEF_PARAM(N) ,DP##N(DEF_P, typename T,)
#define TEMP_SPC_PARAM(N) ,DP##N(DEF_P, T,)
#define FUNC_PTR_PARAM(N) DP##N(DEF_P, T,)
#define FUNC_INV_PARAM(N) DP##N(DEF_P, p,)
#define FUNC_DEF_PARAM(N) DP##N(DEF_D, T, p)
DEFINE_FUNCTOR(1);
DEFINE_FUNCTOR(2);
DEFINE_FUNCTOR(3);
DEFINE_FUNCTOR(4);
DEFINE_FUNCTOR(5);
DEFINE_FUNCTOR(6);
DEFINE_FUNCTOR(7);
DEFINE_FUNCTOR(8);
DEFINE_FUNCTOR(9);
DEFINE_FUNCTOR(10);
DEFINE_FUNCTOR(11);
DEFINE_FUNCTOR(12);
DEFINE_FUNCTOR(13);
DEFINE_FUNCTOR(14);
DEFINE_FUNCTOR(15);
Весь пиздец https://github.com/Evil-Spirit/Nutmeg/blob/master/CoreSrc/Common/Functor.h
Дети, не программируйте на C++
guest 16.08.2014 21:07 # −1