title: Create static array with variadic templates
body: <p>There was an answer on stackoverflow (which I can't seem to find anymore) which demonstrated how a variadic template can be used in C++11 to create a static array at compile time:</p>
  
  <pre><code>template &lt;class T, T... args&gt; 
  struct array_
  {
      static const T data[sizeof...(args)];
  };
  
  template &lt;class T, T... args&gt; 
  const T array_&lt;T, args...&gt;::data[sizeof...(args)] = { args... };
  </code></pre>
  
  <p>A recursive meta-function could be provided to instantiate <code>array_</code> with any number of parameters, which will then be copied at compile time into the internal array.  It's a useful way to create meta-functions for generating constant arrays at compile time.</p>
  
  <p>However, one problem is that it depends on <em>class template parameters</em> to get the actual values to populate the array.  This results in one major limitation: only integral constants can be used as value template parameters.  So, you can't use this technique to generate arrays of custom types.</p>
  
  <p>I tried to think of something to work around this limitation, but can't come up with anything.  Is there any way to make this technique work with non-integral constants?</p>