title: Check a parameter pack for all of type T
body: <p>Jonathan Wakely's <a href="https://stackoverflow.com/a/29603857/3098505">answer</a> to the question <a href="https://stackoverflow.com/questions/29603364/type-trait-to-check-that-all-types-in-a-parameter-pack-are-copy-constructible/29603857#29603857">Type trait to check that all types in a parameter pack are copy constructible</a> gives a simple(ish) way to check if all of the variables expanded in a parameter pack are of the same type - eg:</p>
  
  <pre><code>#include &lt;type_traits&gt;
  
  namespace detail {
      enum class enabler {};
  }
  
  template &lt;bool Condition&gt;
  using EnableIf =
      typename std::enable_if&lt;Condition, detail::enabler&gt;::type;
  
  template&lt;typename... Conds&gt;
  struct and_ : std::true_type {};
  
  template&lt;typename Cond, typename... Conds&gt;
  struct and_&lt;Cond, Conds...&gt;
          : std::conditional&lt;Cond::value, and_&lt;Conds...&gt;,
          std::false_type&gt;::type {};
  
  template&lt;typename... T&gt;
  using areInts = and_&lt;std::is_same&lt;T,int&gt;...&gt;;
  
  template&lt;typename... T&gt;
  using areMySpecificClass = and_&lt;std::is_same&lt;T,MySpecificClass&gt;...&gt;;
  </code></pre>
  
  <p>I can't work out how to extend this, to write a template like <code>areTypeT</code>, for example.</p>
  
  <p>My first attempts stumbled on "Parameter pack 'T' must be at the end of the template parameter list". My more recent attempt compiles, but if I use it then I get substitution failures:</p>
  
  <pre><code>template&lt;typename Target&gt;
  template&lt;typename... T1&gt;
  using areT = and_&lt;std::is_same&lt;T1,Target&gt;...&gt;;
  </code></pre>
  
  <p>How can I make this work?</p>