1 2 3 4 5 6 7 8 9 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
|
typedef std::map<int, void(*)(int, const std::string&) > Row;
template<int From, int To, template<int, int> class Call, int COL>
struct SRegisterRow {
static void run(Row& row) {
Call<From, COL>::run(row);
SRegisterRow<From + 1, To, Call, COL>::run(row);
}
};
template<int Ended, template<int> class Call, int COL>
struct SRegisterRow<Ended, Ended, Call, COL> {
static void run(Row& row) {
}
};
template <int ROW, int COL>
struct SRegisterRowCall {
static void run(Row& row) {
row[COL] = &Test<COL, ROW>::MyFunction;
};
};
typedef std::map<int, Row> Data;
template<int From, int To, template<int> class Call>
struct SRegisterData {
static void run(Data& data) {
Call<From>::run(data);
SRegisterData<From + 1, To, Call>::run(data);
}
};
template<int Ended, template<int> class Call>
struct SRegisterData<Ended, Ended, Call> {
static void run(Data& data) { }
};
template <int COL>
struct SRegisterDataCall {
static void run(Data& data) {
SRegisterRow<0, SInfo<COL>::s_iRowCount, SRegisterRowCall, D>::run(data[COL]);
};
};
Data d;
SRegisterData<0, COL_COUNT - 1, SRegisterDataCall >::run(d); |
Partager