title: What is this template construct?
body: <p>This is from the C++ Standard Library xutility header that ships with VS2012.</p>
  
  <pre class="lang-cpp prettyprint-override"><code>template&lt;class _Elem1,
      class _Elem2&gt;
      struct _Ptr_cat_helper
      {   // determines pointer category, nonscalar by default
      typedef _Nonscalar_ptr_iterator_tag type;
      };
  
  template&lt;class _Elem&gt;
      struct _Ptr_cat_helper&lt;_Elem, _Elem&gt;
      {   // determines pointer category, common type
      typedef typename _If&lt;is_scalar&lt;_Elem&gt;::value,
          _Scalar_ptr_iterator_tag,
          _Nonscalar_ptr_iterator_tag&gt;::type type;
      };
  </code></pre>
  
  <p>Specifically what is the nature of the second _Ptr_cat_helper declaration? The angle brackets after the declarator _Ptr_cat_helper make it look like a specialization. But instead of specifying full or partial types by which to specialize the template it instead just repeats the template argument multiple times.</p>
  
  <p>I don't think I've seen that before. What is it?</p>
  
  <p>UPDATE</p>
  
  <p>We are all clear that the specialization applies to an instantiation of the template where both template arguments are of the same type, but I'm not clear on whether this constitutes a full or a partial specialization, or why.</p>
  
  <p>I thought a specialization was a full specialization when all the template arguments are either explicitly supplied or are supplied by default arguments, and are used exactly as supplied to instantiate the template, and that conversely a specialization was partial either, if not all the template parameters were required due to the specialization supplying one or more (but not all) of them, and/or if the template arguments were used in a form that was modified by the specialization pattern. E.g.</p>
  
  <p>A specialization that is partial because the specialization is supplying at least one, but not all, of the template arguments.</p>
  
  <pre class="lang-cpp prettyprint-override"><code>template&lt;typename T, typename U&gt;
  class G { public: T Foo(T a, U b){ return a + b; }};
  
  template&lt;typename T&gt;
  class G&lt;T, bool&gt; { public: T Foo(T a, bool b){ return b ? ++a : a; }};
  </code></pre>
  
  <p>A specialization that is partial because the specialization is causing the supplied template argument to be used only partially.</p>
  
  <pre class="lang-cpp prettyprint-override"><code>template&lt;typename T&gt;
  class F { public: T Foo(T a){ return ++a; }};
  
  template&lt;typename T&gt;
  class F&lt;T*&gt; { public: T Foo(T* a){ return ++*a; }};
  </code></pre>
  
  <p>In this second example if the template were instantiated using A&lt;char*&GT; then T within the template would actually be of type char, i.e. the template argument as supplied is used only partially due to the application of the specialization pattern.</p>
  
  <p>If that is correct then wouldn't that make the template in the original question a full specialization rather than a partial specialization, and if that is not so then where is my misunderstanding?</p>