I am going to use MySQL connector. They provide functions to access the result row. Some examples are getString(1), getInt(1), getDate(2). The number inside the parenthesis is about the index of the result.
So that I have to use the following code to access this example row: 'John', 'M', 34
string name = row.getString(1);
string sex = row.getString(2);
int age = row.getInt(3);
I would like to try generic programming for various reasons (mainly for fun). But it was quite disappointing that I can't make it happens even with much time used.
The final result that I want:
std::tie<name, sex, age> = row.getResult<string, string, int>();
This functions should call the corresponding MySQL API.
It is also good to see any answer similar to below, although the syntax is wrong.
std::tie<name, sex, age> = row.getResult([string, string, int]);
Please don't suggest using for-loop. Let's try something more generic & functional ;-)