Initialize a local static const array with values of another array
<p>Suppose that I want to declare a <strong>local</strong> static constant array, but I don't know its initializer values in compile time, and those have to be calculated first. <em>For example</em>, I have an array <code>int p[100]</code>. I write a loop to fill it with first 100 prime numbers. After those are calculated, I define a <code>static const int primes[100]</code> which has to be initialized by the values of <code>p</code>. How can I do this?</p>

<p>P.S. The question of "<em>why</em> I want to declare a local static const object?" may not have a satisfactory answer, but I think this is not the case here.</p>

<p>P.S.S. I mentioned the prime numbers just as an example. That is not the point.</p>

<p>P.S.S.S. Let's say <code>p</code> has 1000000 members. Then the solution suggested by user2079303 surely deserves more upvotes.</p>