Here's my problem: I'm trying to write a program to modify gamma corrected images, but the gamma correction (which involves an RGB value, an unsigned char, to the power 2.5, or a gamma corrected value, a double, to the power 0.4) is currently taking most of the time, so I want to patch in a lookup table to speed things up. For exponentiating an unsigned char this is easy because there's only 256 possible values. Converting back can use the same table, but the best I can come up with is looping through the entire table, comparing the input with the values in the table to check what integer value is the correct answer. (luckily it's a monotonously increasing function)
What would be a quick way to go about this? Is there perhaps a container in the STL that can do something like this?