title: Modern C++: initialize constexpr tables
body: <p>Suppose I have a class <code>X</code>, which functionality requires a lot of constant table values, say an array <code>A[1024]</code>. I have a recurrent function <code>f</code> that computes its values, smth like</p>
  
  <pre><code>A[x] = f(A[x - 1]);
  </code></pre>
  
  <p>Suppose that <code>A[0]</code> is a known constant, therefore the rest of the array is constant too. What is the best way to calculate these values beforehand, using features of modern C++, and without storaging file with hardcoded values of this array? My workaround was a const static dummy variable:</p>
  
  <pre><code>const bool X::dummy = X::SetupTables();
  
  bool X::SetupTables() {
      A[0] = 1;
      for (size_t i = 1; i &lt;= A.size(); ++i)
          A[i] = f(A[i - 1]);
  }
  </code></pre>
  
  <p>But I believe, it’s not the most beautiful way to go. 
  Note: I emphasize that array is rather big and I want to avoid monstrosity of the code. </p>