title: Why doesn't this recursive template work?
body: <p>So I've tried to create what I thought would be a simple recursive template to generate a large but trivial nested type:</p>
  
  <pre><code>#include &lt;type_traits&gt;
  #include &lt;typeinfo&gt;
  
  #include &lt;boost/core/demangle.hpp&gt;
  
  template &lt;typename T&gt;
  struct A {};
  
  template &lt;typename T, int N&gt;
  struct Nest
  {
    using type = Nest&lt;A&lt;T&gt;, N-1&gt;
  };
  
  template &lt;typename T&gt;
  struct Nest&lt;T, 0&gt;
  {
    using type = T;
  };
  
  int main()
  {
    typename Nest&lt;A&lt;int&gt;, 20&gt;::type x;
    std::cout &lt;&lt; boost::core::demangle(typeid(x).name());
  };
  </code></pre>
  
  <p>The output of this program is</p>
  
  <pre><code>Nest&lt;A&lt;A&lt;int&gt; &gt;, 19&gt;
  </code></pre>
  
  <p>I was expecting to see a list of <code>A&lt;int&gt;</code> nested within 19 layers of <code>A&lt;&gt;</code>. What is happening here, and what do I have to do to get the effect I am looking for?</p>