title: Getting argument count of a function pointer
body: <p>I'm now using this code:</p>
  
  <pre><code>    size_t argc(std::function&lt;Foo()&gt;)
      { return 0; }
  
      size_t argc(std::function&lt;Foo(Bar)&gt;)
      { return 1; }
  
      size_t argc(std::function&lt;Foo(Bar, Bar)&gt;)
      { return 2; }
  
      size_t argc(std::function&lt;Foo(Bar, Bar, Bar)&gt;)
      { return 3; }
  
      // ...
  </code></pre>
  
  <p>But it is kinda ugly and limited (the user can't call <code>argc</code> with a function with any number of arguments.) Is there a better way to do it?</p>
  
  <p>Note: the return type and the argument type are always the same. I know I can use templates to accept any type, but I don't need it.</p>