title: C++11: I can go from multiple args to tuple, but can I go from tuple to multiple args?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/687490/how-do-i-expand-a-tuple-into-variadic-template-functions-arguments">How do I expand a tuple into variadic template function&#39;s arguments?</a><br>
    <a href="https://stackoverflow.com/questions/7858817/unpacking-a-tuple-to-call-a-matching-function-pointer">&ldquo;unpacking&rdquo; a tuple to call a matching function pointer</a>  </p>
  </blockquote>
  
  
  
  <p>In C++11 templates, is there a way to use a tuple as the individual args of a (possibly template) function?</p>
  
  <p>Example:<br>
  Let's say I have this function:  </p>
  
  <pre><code>void foo(int a, int b)  
  {  
  }
  </code></pre>
  
  <p>And I have the tuple <code>auto bar = std::make_tuple(1, 2)</code>.</p>
  
  <p>Can I use that to call <code>foo(1, 2)</code> in a templaty way?</p>
  
  <p>I don't mean simply <code>foo(std::get&lt;0&gt;(bar), std::get&lt;1&gt;(bar))</code> since I want to do this in a template that doesn't know the number of args.</p>
  
  <p><strong>More complete example:</strong></p>
  
  <pre><code>template&lt;typename Func, typename... Args&gt;  
  void caller(Func func, Args... args)  
  {  
      auto argtuple = std::make_tuple(args...);  
      do_stuff_with_tuple(argtuple);  
      func(insert_magic_here(argtuple));  // &lt;-- this is the hard part  
  }
  </code></pre>
  
  <p>I should note that I'd prefer to not create one template that works for one arg, another that works for two, etc…</p>