I have data represented as follows:
I need to make this data accessible in my C++ application. I also need to be able to access items associatively via variable key names; for example:
std::string key = "ema50";
double value = data[key];
A std::vector<std::map<std::string, double>>
would be great for this, except I'm not sure what to do about the groups
item. I'd like to be able access the testing
or validation
arrays for a given item in the vector:
int testingGroups[9] = data["groups"]["testing"];
int validationGroups[9] = data["groups"]["validation"];
Is there a way I can accomplish this? I'm do prefer to use vectors and maps, but I'm open to other solutions so long as I can access data items associatively.
Would using templates like described here be the way to go?