title: For C++ templates, is there a way find types that are "valid" inputs?
body: <p>I have a library where template classes/functions often access explicit members of the input type, like this:</p>
  
  <pre><code>template &lt;
  typename InputType&gt;
  bool IsSomethingTrue(
    InputType arg1) {
  
    typename InputType::SubType1::SubType2 &amp;a;
  
    //Do something
  
  }
  </code></pre>
  
  <p>Here, <code>SubType1</code> and <code>SubType2</code> are themselves generic types that were used to instantiate <code>InputType</code>.  Is there a way to quickly find all the types in the library that are valid to pass in for <code>InputType</code> (likewise for <code>SubType1</code> and <code>SubType2</code>)?  So far I have just been searching the entire code base for classes containing the appropriate members, but the template input names are reused in a lot of places so it is very cumbersome.</p>
  
  <p>From a coding perspective, what is the point of using a template like this when there is only a limited set of valid input types that are probably already defined?  Why not just overload this function with explicit types rather than making them generic?</p>