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
|
template<typename T>
CString print(const T& t )
{
return JD::to_cstring(t);
}
template<typename T>
struct P
{
CJDGridCtrl grid;
std::vector<C> lines{ C{"val", "val2", "str", "str2", 5}, C{"val2", "val3", "str2", "str3", 6 } };
template<typename ...DataTypes>
void display(DataTypes... dts)
{
getData(0, 1, lines[0], dts...);
getData(1, 1, lines[1], dts...);
}
template<typename DataType>
void getData(int row, int col, T& z, DataType p)
{
auto value = z.*p;
auto cs = print(value);
grid.SetItemText(row + 1, col, cs);
}
template<typename DataType, typename ... RestDataTypes>
void getData(int row, int col, T& z, DataType p, RestDataTypes...qs)
{
auto value = z.*p;
auto cs = print(value);
grid.SetItemText(row + 1, col, cs);
getData(row, ++col, z, qs...);
}
};
| |