title: C++ : using index as template parameter in for loop
body: <p>given following templates and specialization</p>
  
  <pre class="lang-cpp prettyprint-override"><code>enum CountryName 
  {
      Armenia = 0 ,
      Georgia,
      Size = 2
  };
  
  template &lt;CountryName variable&gt;
  class CountryInfo;
  
  template &lt;&gt;
  class CountryInfo&lt;Armenia&gt; 
  {
      /* CODE HERE */
  };
  
  template &lt;&gt;
  class CountryInfo&lt;Georgia&gt; 
  {
      /* CODE HERE */
  };
  </code></pre>
  
  <p>I would like to iterate over enum and create object for each specialization.</p>
  
  <pre class="lang-cpp prettyprint-override"><code>main() {
      for(auto i=0; i&lt;CountryName::Size; ++i) {
          CountryInfo&lt;(static_cast&lt;CountryName&gt;(i))&gt;();
      }       
  }   
  </code></pre>
  
  <p>I get following error:
  <strong>error: the value of 'i' is not usable in a constant expression
     CountryInfo&lt;(static_cast(i))>();</strong></p>