title: Multiple possible templates in a class
body: <p>I am trying to have a class which can be created with either a type or an array. I am not sure if templates are the best way to do this but I thought they might work. In the below code example, I have a class which has two static methods who both return an instance of the class based on the template they are given:</p>
  
  <pre><code>template&lt;class T&gt;
  template&lt;class A, size_t N&gt;
  class Foo {
      static A[N] bar();
      static T bar();
  }
  
  template&lt;class A, size_t N&gt;
  Foo&lt;A[N]&gt; Foo&lt;A[N]&gt;::bar();
  
  template&lt;class T&gt;
  Foo&lt;T&gt; Foo&lt;T&gt;::bar();
  </code></pre>
  
  <p>So I can call them like this:</p>
  
  <pre><code>Foo&lt;int[5]&gt; intarrthing Foo&lt;int[5]&gt;::bar();
  Foo&lt;int&gt; intthing Foo&lt;int&gt;::bar();
  </code></pre>
  
  <p>This doesn't work because not all the templates are used so how could I implement something like this?</p>