title: c++ template functions with variable arguments
body: <p>Is it possible to write a c++ template function which takes a variable number of input variables of different types (number of input can be limited to say 10)?
  For example take a function <code>sql_exec()</code> which executes an sql query string and saves the resulting rows in std vectors of the type supplied, i.e. </p>
  
  <pre><code>std::vector&lt;double&gt; x,y;
  std::vector&lt;std::string&gt; s;
  std::string query="select * from ...";
  
  sql_exec(query, s,x,y); // error if less than 3 rows or conversion not possible
  </code></pre>
  
  <p>Now my naive approach would have been (limited to max 2 vectors)</p>
  
  <pre><code>struct null_type {};
  template &lt;typename T1=null_type, typename T2=null_type&gt;
  void sql_query(const std::string&amp; query_str, std::vector&lt;T1&gt;&amp; col1,
             std::vector&lt;T2&gt;&amp; col2) {
      ...
  }
  </code></pre>
  
  <p>Of course that's stupid as I didn't tell the function about default arguments and we get</p>
  
  <pre><code>error: default template arguments may not be used in function templates
  </code></pre>
  
  <p>but actually it compiles with gcc and <code>-std=c++0x</code>. However, obviously <code>sql_query()</code> still doesn't take variable length input and needs to be called with 2 vectors. Also, I'd like to have something portable working on most of the current compilers. Anything obvious I've overlooked? I know I can change the design and maybe use <code>boost::tuple</code> or something else but I'd have liked such a simple interface.</p>