Apply function on each element in parameter pack : <p>I have the following template function with specialization:</p>

<pre><code>// Pass the argument through ...
template&lt;typename T, typename U=T&gt;
U convert(T&amp;&amp; t) {
  return std::forward&lt;T&gt;(t);
}

// ... but convert std::strings
const char* convert(std::string s) {
  return s.c_str();
}
</code></pre>

<p>If I then have a variadic template function like:</p>

<pre><code>template&lt;typename ... Args&gt;
void doSomething(Args ... args) {
  // Convert parameter pack using convert function above
  // and call any other variadic templated function with
  // the converted args.
}
</code></pre>

<p>Is there any way to convert the parameter pack using the convert function as in the comment?</p>

<p>My original goal was being to be able to pass std::string to '%s' in a printf like function without having to manually calling .c_str() on the strings first. But I am also interested in general if this can be done in a simple way, my tries so far failed.</p>
