title: C++ Convert a parameter pack of types to parameter pack of indices
body: <p>Is there any way to convert a parameter pack of types to a parameter pack of integers from <code>0</code> to <code>sizeof...(Types)</code>? More specifically, I'm trying to do something this this:</p>
  
  <pre><code>template &lt;size_t... I&gt;
    void bar();
  
  template &lt;typename... Types&gt;
    void foo() {
      bar&lt;WHAT_GOES_HERE&lt;Types&gt;...&gt;();
    }
  </code></pre>
  
  <p>For example, <code>foo&lt;int,float,double&gt;()</code> should call <code>bar&lt;0, 1, 2&gt;()</code>;</p>
  
  <p>In my use case the parameter pack <code>Types</code> may contain the same type multiple times, so I cannot search the pack to compute the index for a given type.</p>