title: Gluing a variadic template to a variadic function
body: <p>In an attempt to bypass GCC's unimplemented always-inlining variadic functions in libc++, I thought I could maybe wrap the variadic functions (like snprintf, more precisely, the *_l variant) in a variadic template to achieve a similar effect. An instantiation would fill in the variadic function's varargs, allowing the function to be nicely inlined. The problem is, I don't know the first thing about writing variadic templates, and I certainly don't know how to turn the template arguments into seperate arguments.</p>
  
  <p>The code I'm looking to replace is of the form:</p>
  
  <pre><code>int __sprintf_l(char *__s, locale_t __l, const char *__format, ...) {
    va_list __va;
    va_start(__va, __format);
    int __res = vsprintf_l(__s, __l, __format, __va);
    va_end(__va);
    return __res;
  }
  </code></pre>
  
  <p>I'd like to replace is with something of the form:</p>
  
  <pre><code>template&lt;typename... Args&gt;
  int __sprintf_l(char *__s, locale_t __l, const char *__format, Args... args) {
    int __res = vsprintf_l(__s, __l, __format, args...);
    return __res;
  }
  </code></pre>
  
  <p>This is not working, due to the expanded <code>args...</code> which cannot be converted to <code>type</code> to <code>va_list {aka char*}</code>. If there is no way, I'll have to trust Howard and implement one-, and two-argument always-inline templates, which would effectively double the amount of needed code.</p>
  
  <p>EDIT: perhaps a way to convert the <code>std::tuple</code> that <code>args</code> is into a va_list would work here?</p>