title: Multiple variadic templated delegate system
body: <p>So, I've recently build a delegate system using c++11's variadic templates, and it works just as a charm.</p>
  
  <p>However in the system I've built arguments to functions are given at creation-time (as I'd like), but now I'd also like to be able to pass some (variable) number of arguments at call-time. In order to achieve this, I went and redid my code, however is where I'm getting the issues;</p>
  
  <pre><code>error: parameter packs must be at the end of the parameter list
  sorry, unimplemented: cannot expand ‘Arguments ...’ into a fixed-length argument list
  error: type/value mismatch at argument 1 in template parameter list for ‘template&lt;&lt;declaration error&gt;, class ... Params&gt; class FunctionDelegate’
  </code></pre>
  
  <p>... and a lot more to come, so here's a snippet that spawned the issue;</p>
  
  <pre><code>template&lt;typename... Params&gt; 
  class Runnable
  {
      public:
          virtual void invoke(tuple&lt;Params...&gt; params) = 0;
          virtual ~Runnable() 
          {
          }
  };
  </code></pre>
  
  <p>This is the parent class for my two delegates (FunctionDelegate and ObjectDelegate). This used to be an untemplated class (as invoke didn't take any arguments), however as I've a variadic template list to it, I had to modify my subclasses as well (obviously), and I've just added another variadic template to them;</p>
  
  <pre><code>template&lt;typename... Arguments, typename... Params&gt;
  class FunctionDelegate : public Runnable&lt;Params...&gt;
  {
      public:
          typedef void (*FunctionType)(Arguments..., Params...);
  
          FunctionDelegate(FunctionType function, tuple&lt;Arguments...&gt; args)
              : function(function), args(args)
          {
          }
  
          void invoke(tuple&lt;Params...&gt; params) 
          {
              callFunction(typename gens&lt;sizeof...(Arguments)&gt;::type(), params, typename gens&lt;sizeof...(Params)&gt;::type());
          }
      private:
          template&lt;int... S, int... R&gt;
          void callFunction(seq&lt;S...&gt;, tuple&lt;Params...&gt; params, seq&lt;R...&gt;)
          {
              function(get&lt;S&gt;(args)..., get&lt;R&gt;(params)...);
          }
      private:
          FunctionType function;
          tuple&lt;Arguments...&gt; args;
  };
  </code></pre>
  
  <p>This however, does not seem to be allowed, atleast that's what I suspect, so;</p>
  
  <ol>
  <li>Is it allowed to have two variadic template lists?</li>
  <li>Is there some way, that I can hint the compiler, about which goes to which list? (namely the ones used in the constructor goes to Arguments, and the rest to Params).</li>
  <li>If there's simply no way to do this (using two variadic template lists), isn't it possible using one, Arguments and Parameters in the same variadic list, and then simply splitting that using the arguments to the constructor?</li>
  <li>Is there any other way to achieve what I'm trying? (except from using the plain old, non type-checked variadic parameter passing). </li>
  </ol>
  
  <p>Any help or insight is welcome. </p>