title: Function class accepting variable number of arguments from a container at runtime
body: <p>I'm looking for a way to implement a function class</p>
  
  <pre><code>template&lt;class ValueType&gt;
  class Function { ... };
  </code></pre>
  
  <p>which can be constructed with a function pointer (or functor) that takes any number of arguments of type <code>ValueType</code> and returns <code>ValueType</code>. For example, given these functions:</p>
  
  <pre><code>double foo(double);
  double bar(double, double);
  int    baz(double, int);
  </code></pre>
  
  <p>a <code>Function&lt;double&gt;</code> object could be constructed with either <code>foo</code> or <code>bar</code> but not <code>baz</code>.</p>
  
  <p>Then, a member function <code>call</code> will, given some container of <code>ValueType</code> (or an iterator), call the underlying function with the right number of arguments at runtime.</p>
  
  <p>Is such thing possible?</p>