title: Extract the generic type of another generic type in C++
body: <p>Say I have a class Foo which uses two different generic types, one is <code>_Type</code> and the other is <code>_Comparator</code>.  <code>_Type</code> is known to be a <code>std::vector</code>, <code>std::list</code>, or <code>std::string</code>, so it will have a type within it: <code>T</code> will be within <code>vector</code> and <code>list</code>; <code>char</code> will be within <code>string</code>.</p>
  
  <p>My other generic type <code>_Comparator</code> is an optional template parameter, by which the user may specify her own less than function, functor, or lambda function.  If no argument is provided as the second template parameter, it should default to the <code>std::less&lt;M&gt;</code> functor, whereby type <code>M</code> shall be the type of elements contained within <code>_Type</code>.  </p>
  
  <p>I do not know the syntax for how to do this. </p>
  
  <p>I've tried:</p>
  
  <pre><code>template &lt;typename _Type&lt;T&gt;, typename _Comparator = less&lt;T&gt; &gt;
  </code></pre>
  
  <p>to no avail.</p>