title: Template function specialization for template class
body: <p>Is it possible to write something like this in C++11/14?</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;vector&gt;
  
  template &lt;typename T&gt;
  T Get();
  
  template &lt;typename T&gt;
  struct Data {
      std::vector&lt;T&gt; data;
  };
  
  template &lt;&gt;
  template &lt;typename T&gt;
  Data&lt;T&gt; Get&lt;Data&lt;T&gt;&gt;() {
      return Data&lt;T&gt;{{T{}, T{}}};
  }
  
  template &lt;&gt;
  template &lt;typename T&gt;
  std::vector&lt;T&gt; Get&lt;std::vector&lt;T&gt;&gt;() {
      return std::vector&lt;T&gt;(3);
  }
  
  int main() {
      std::cout &lt;&lt; Get&lt;Data&lt;int&gt;&gt;().data.size() &lt;&lt; std::endl;  // expected output is 2
      std::cout &lt;&lt; Get&lt;std::vector&lt;int&gt;&gt;().size() &lt;&lt; std::endl; // expected output is 3
      return 0;
  }
  </code></pre>
  
  <p>Overloading won't help in this case, since call to <code>Get&lt;...&gt;()</code> will be ambiguious (<a href="http://coliru.stacked-crooked.com/a/6e91a8e6b8b6a61f" rel="nofollow">see</a>):</p>
  
  <pre><code>template &lt;typename T&gt;
  Data&lt;T&gt; Get() {
      return Data&lt;T&gt;{{T{}, T{}}};
  }
  
  template &lt;typename T&gt;
  std::vector&lt;T&gt; Get() {
      return std::vector&lt;T&gt;(3);
  }
  </code></pre>
  
  <p>Any direction on how to overcome this are welcome.</p>