title: Get a new tuple containing all but first element of a tuple
body: <p>Given a <code>std::tuple&lt;A, B, ...&gt; foo</code> is there any generic (templated) function or technique in C++14 to get a new tuple <code>std::tuple&lt;B, ...&gt; bar</code> which contains all but the first element of <code>foo</code>? Or, perhaps something in Boost?</p>
  
  <p>I've written a helper function using parameter packs and some template metaprogramming to do this, but I'd love to throw all of that stuff away!</p>
  
  <p>Here's what I'm currently doing. I define a helper function <code>unshift_tuple()</code> which returns a tuple containing all but the first element of the tuple passed to the function. The implementation of <code>unshift_tuple()</code> uses a helper function <code>unshift_tuple_with_indices()</code> which takes a parameter pack containing the tuple indices to extract; the <code>sequential_integer_list</code> helper type is used to generate the appropriate index list parameter pack using template metaprogramming. Ugly!</p>
  
  <pre><code>#include &lt;tuple&gt;
  
  template &lt;size_t... Integers&gt;
  struct integer_list {};
  
  template &lt;size_t N, size_t... Args&gt;
  struct sequential_integer_list : sequential_integer_list&lt;N - 1, N - 1, Args...&gt; {};
  
  template &lt;size_t... Args&gt;
  struct sequential_integer_list&lt;0, Args...&gt; { typedef integer_list&lt;Args...&gt; type; };
  
  template &lt;typename FirstElement, typename... Elements, size_t... Indices&gt;
  static std::tuple&lt;Elements...&gt; unshift_tuple_with_indices(
      const std::tuple&lt;FirstElement, Elements...&gt;&amp; tuple,
      integer_list&lt;Indices...&gt; index_type)
  {
      return std::make_tuple(std::get&lt;Indices + 1&gt;(tuple)...);
  }
  
  template &lt;typename FirstElement, typename... Elements&gt;
  std::tuple&lt;Elements...&gt;
  unshift_tuple(const std::tuple&lt;FirstElement, Elements...&gt;&amp; tuple)
  {
      return unshift_tuple_with_indices(tuple,
          typename sequential_integer_list&lt;sizeof...(Elements)&gt;::type());
  }
  
  int main(int, char *[])
  {
      std::tuple&lt;int, std::string, double&gt; foo(42, "hello", 3.14);
  
      std::tuple&lt;std::string, double&gt; bar = unshift_tuple(foo);
  }
  </code></pre>
  
  <p>To be clear, this code works just fine. I just wish very much to delete it (or any portion of it) and use something built-in instead, if possible!</p>
  
  <hr>
  
  <h2>Edit</h2>
  
  <p>Jarod42 pointed out the existence of <code>std::integer_list</code> in C++14 which simplifies the implementation to something like:</p>
  
  <pre><code>#include &lt;cstddef&gt;
  #include &lt;tuple&gt;
  #include &lt;utility&gt;
  
  template &lt;typename T1, typename... T, size_t... Indices&gt;
  std::tuple&lt;T...&gt; unshift_tuple_with_indices(
      const std::tuple&lt;T1, T...&gt;&amp; tuple, std::index_sequence&lt;Indices...&gt;)
  {
      return std::make_tuple(std::get&lt;Indices + 1&gt;(tuple)...);
  }
  
  template &lt;typename T1, typename... T&gt; std::tuple&lt;T...&gt;
  unshift_tuple(const std::tuple&lt;T1, T...&gt;&amp; tuple)
  {
      return unshift_tuple_with_indices(tuple,
          std::make_index_sequence&lt;sizeof...(T)&gt;());
  }
  </code></pre>