title: When to use std::forward to forward arguments?
body: <p>C++0x shows an example of using <code>std::forward</code>:</p>
  
  <pre><code>template&lt;class T&gt;
  void foo(T&amp;&amp; arg) 
  {
    bar(std::forward&lt;T&gt;(arg));
  }
  </code></pre>
  
  <p>When is it advantageous to use <code>std::forward</code>, always?</p>
  
  <p>Also, it requires to use <code>&amp;&amp;</code> in the parameters declaration, is it valid in all cases? I thought you had to pass temporaries to a function if the function was declared with <code>&amp;&amp;</code> in it, so can foo be called with any parameter?</p>
  
  <p>Lastly, if I have a function call such as this:</p>
  
  <pre><code>template&lt;int val, typename... Params&gt;
  void doSomething(Params... args) {
    doSomethingElse&lt;val, Params...&gt;(args...);
  }
  </code></pre>
  
  <p>Should I use this instead:</p>
  
  <pre><code>template&lt;int val, typename... Params&gt;
  void doSomething(Params&amp;&amp;... args) {
    doSomethingElse&lt;val, Params...&gt;(std::forward&lt;Params&gt;(args)...);
  }
  </code></pre>
  
  <p>Also, if use the parameters twice in the function, i.e. forwarding to two functions at the same time, is it wise to use <code>std::forward</code>? Won't <code>std::forward</code> convert the same thing to a temporary twice, moving the memory and make it invalid for a second use? Would the following code be ok:</p>
  
  <pre><code>template&lt;int val, typename... Params&gt;
  void doSomething(Params&amp;&amp;... args) {
    doSomethingElse&lt;val, Params...&gt;(std::forward&lt;Params&gt;(args)...);
    doSomethingWeird&lt;val, Params...&gt;(std::forward&lt;Params&gt;(args)...);
  }
  </code></pre>
  
  <p>I'm a bit confused by <code>std::forward</code>, and I'd gladly use some clearing up.</p>