title: Compile time static array of types
body: <p>I'm trying to build a static array of dynamic arrays...at compile time.  Some examples:</p>
  
  <pre><code>struct Apple {
    int x;
  };
  
  struct Pear {
    int a, b;
  };
  </code></pre>
  
  <p>then...</p>
  
  <pre><code>Registry&lt;Apple, Pear&gt; registry;
  auto appleId = registry.add&lt;Apple&gt;(1);
  auto pearId = registry.add&lt;Pear&gt;(1, 2);
  
  Apple* apple = registry.get&lt;Apple&gt;(appleId);
  </code></pre>
  
  <p>or...</p>
  
  <pre><code>Registry registry;
  registry.register&lt;Apple&gt;();
  registry.register&lt;Pear&gt;();
  </code></pre>
  
  <p>...although the second example would probably be even harder to do at compile time.</p>
  
  <p>I would assume that the data structure inside looks like this:</p>
  
  <pre><code>template &lt;typename... Ts&gt;
  struct Registry {
    std::array&lt;std::vector&lt;?&gt;, sizeof...(Ts)&gt; values;
  };
  </code></pre>
  
  <p>Any ideas on how to start exploring this problem?</p>