title: Split parameter pack in 0 ... N-1 and Nth element
body: <p>I would like to split a parameter pack into the first N - 1 and the Nth parameters without using the typical index_sequence &amp; tuple trick but cannot seem to wrap my head around it, yet I'm pretty sure it should be doable? (getting the last item is easy enough with recursion).</p>
  
  <p>The final function to call looks like</p>
  
  <pre><code>void Fun( Foo a, Bar b );
  </code></pre>
  
  <p>and a is acquired from a variadic one in turn:</p>
  
  <pre><code>template&lt; class... T &gt;
  Foo CalcFoo( T... args );
  </code></pre>
  
  <p>My current implementation:</p>
  
  <pre><code>//get the last item of the pack
  template&lt; class T &gt;
  T split_last( T t ){ return t; }
  
  template&lt; class... T &gt;
  T split_last( T, T... t ){ return split_last( t... ); }
  
  //helper
  template&lt; class... T, size_t... Indices &gt;
  Foo CalcFoo( const std::tuple&lt; T... &gt;&amp; args, index_sequence&lt; Indices... &gt; )
  {
    return CalcFoo( std::get&lt; Indices &gt;( args )... );
  }
  
  //split and call
  template&lt; class... T &gt;
  void MoreFun( T... args )
  {
    //make a tuple containing all, then get n -1 items out of it
    const auto tup = std::make_tuple&lt; T... &gt;( args... );
    Fun( CalcFoo( tup, make_index_sequence&lt; sizeof...( T ) - 1 &gt;() ),
         split_last( args... ) ); 
  }
  </code></pre>
  
  <p><strong>update</strong> apart from wanting to know how to do this without a tuple just for the sake of it I also asked this because I somehow thought maybe a tuple would cause overhead. Thereby ignoring the premature optimization mantra, which, as usual, turned out to be correct once again. Compiled in release mode with VS2013 both my and Horstling's code yield the <em>exact</em> same assembly code. Everything including <code>CalcFoo</code> is inlined up until the call to <code>Fun</code>. In other words: the tuple is completely gone. So I'll probably stick with this implementation anyway because it's pretty clear.</p>