Question: Here is a code snippet illustrating my question:

```
const float D    = 0.1F;
const float A[4] = {sin(0*D), sin(1*D), sin(2*D), sin(3*D)};

```

Imagine that global array `A` is much longer and you don't want to do all of this repetitive typing. Is there a shorter way to initialize array A at compile or initialization time, i.e. without having to write initialization function and call it somewhere in my program?

Answer: 
You could initialize A during dynamic initialization time as follows:

```
const float *init_a(float x_)
{
  static float data[4];
  for(unsigned i=0; i<4; ++i)
    data[i]=sin(i*x_);
  return data;
}

const float D=0.1f;
const float *A=init_a(D);

```
Ok I just realized this doesn't actually answer the question, because it specifies "without having to write initialization function and call it somewhere in my program?" But I can't think of a convenient alternative.

```
template<size_t N>
std::array<float, N> GetLookupTable(float d)
{
    std::array<float, N> table;
    // .. populate table here
    return table;
}

// a global somewhere
(static?) const auto Table_10x5 = GetLookupTable<10>(5.0f);

```