I'm helping to debug a friend's code but have just bumped into some very weird notation that I simply cannot understand: double testValueC2 = (((_data[step])[itElem->first])[gp])["RATIO"];
Where the types are: double testValueC2 = ((((vector<map<int,vector<map<string,double>>>>)_data[(int)step])[(map<int, vector< map<string,double> > >::iterator)itElem->first])[(int)gp])["RATIO"];
I think I just made this more confusing, huh?
I just don't understand what all those parentheses and brackets along with a lack of functions or operators is supposed to mean. Keep in mind that I almost cried at the sight of vector<map<int,vector<map<string,double>>>> and don't really know what that means, either.
So you have _data, a vector of that ugly crap. You read the step-th element of that vector, then read some external iterator itElem and get it's first data (an int), and use that to access the itElem->first-th element of the map of that crap. That should return a vector<map<string, double>> type.
Then you access the gp-th element of that vector, which gives you a map<string, double>. Finally, you access the "RATIO" key-value pair of that map and return that value.
I don't think that will help you much without knowing what all those variables are supposed to be. Like, what is _data? If your friend can't answer it well enough, then the code is evidently not even really readable to them. If you really want to try to understand, I think a picture might help.
data = vector < map< int, vector< map <string, double> > > >
A vector of maps of ints/[vectors of maps of strings/doubles]
step = int
itElem = an iterator of type map<int, vector< map<string, double> > >
An iterator of one of the elements of data (probably?)
gp = int
But basically (sort of like what Zhuge is saying):
You first get the step-th element of _data, which is a map of ints/[vector of maps of strings/doubles].
Then, you get the itElem->first-th (an int) element of That, which is a vector of [maps of strings/doubles.]
Finally, you try to access gp-th part of that vector, which gives you a map of strings/doubles.
You then access that map using "RATIO" as the key, getting a double.
Maybe your issue is that the key "RATIO" isn't defined yet so you are getting a default constructed double (0 or garbage probably).