Reputation: 407
I have a set of settings in a class that I need to iterate through:
A,B,C,D
The end result of each iteration is a single number, what is the best way to find out from the index of the result list what the values of A,B,C and D are?
e.g.
A= 2 to 10 in steps of 0.1 B= 4 to 20 in steps of 0.5 C= 5 to 50 in steps of 0.2 D= 6 to 70 in steps of 3
And the results come as indexes in a list from each iteration e.g.
Iteration[0] = 2; (A=2,B=4,C=5,D=6) Iteration[1] = 10; (A=2,B=4,C=5,D=9)
If I have the original settings what is the best way to reverse lookup the values of A,B,C,D from the index number?
I also need to carry out the opposite calculation too, from a set of settings, what is the index.
Any help would be great!
Thanks,
Chris.
Upvotes: 1
Views: 515
Reputation: 2519
Take a look at boost reverse mapping http://www.boost.org/doc/libs/1_50_0/libs/bimap/doc/html/index.html Maybe this helps
Upvotes: 1