title: Programmatically create static arrays at compile time in C++
body: <p>One can define a static array at compile time as follows:</p>
  
  <pre><code>const std::size_t size = 5;    
  unsigned int list[size] = { 1, 2, 3, 4, 5 };
  </code></pre>
  
  <p><strong>Question 1</strong> - Is it possible by using various kinds of metaprogramming techniques to assign these values "programmatically" at compile time?</p>
  
  <p><strong>Question 2</strong> - Assuming all the values in the array are to be the same barr a few, is it possible to selectively assign values at compile time in a programmatic manner?</p>
  
  <p>eg:</p>
  
  <pre><code>const std::size_t size = 7;        
  unsigned int list[size] = { 0, 0, 2, 3, 0, 0, 0 };
  </code></pre>
  
  <ol>
  <li>Solutions using C++0x are welcome</li>
  <li>The array may be quite large, few
  hundred elements long</li>
  <li>The array for now will only consist of
  POD types</li>
  <li>It can also be assumed the size of
  the array will be known beforehand,
  in a static compile-time compliant
  manner.</li>
  <li>Solutions must be in C++ <strong><em>(no script, no macros, no pp
  or code generator based solutions pls)</em></strong></li>
  </ol>
  
  <p><strong>UPDATE:</strong> Georg Fritzsche's solution is amazing, needs a little work to get it compiling on msvc and intel compilers, but nonetheless a very interesting approach to the problem.</p>