I appreciate I am being somewhat vague about what is exactly my issue, but I think that the fundamental question is clear. Please bear with me for a moment.
In brief, I have a static constexpr
array of points which are used to find certain bounds I need to use. These bounds depend only on the array, so they can be precomputed. However, we want to be able to change these points and it is a pain to go and change every value every time we try to test something.
For example, let's say that I have the following setup:
The static constexpr
array is
static constexpr double CHECK_POINTS[7] = { -1.5, -1.0, -0.5, 0.0, -0.5, 1.0, 1.5 };
and then in a function I'm calling, I have the following block of code:
std::vector<double> bounds = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
for(int i=0; i<bounds.size(); i++)
{
bounds[i] = std::exp(CHECK_POINTS[i]);
}
Clearly, the values of bounds
can be computed during compilation. Is there anyway I can make gcc do that?
EDIT: The vector in my code block is not essential, an array will do.