title: Dispatch for binary and unary callables in C++03
body: <p>I'm having troubles implementing this in legacy C++, but I'm pretty sure it can be done. Say I have a higher order function that needs two versions, one for unary callables (function objects, functions, member functions)</p>
  
  <pre><code>template &lt;class F&gt;
  void ho_fun(F argFun) { 
      int arg1; 
      argFun(arg1); 
  }
  </code></pre>
  
  <p>and one for binary: </p>
  
  <pre><code>template &lt;class F&gt;
  void ho_fun(F argFun) { 
      int arg1, arg2; 
      argFun(arg1, arg2); 
  }
  </code></pre>
  
  <p>I'm looking for a complete solution in terms of "callable type" (otherwise I'd obviously use <a href="http://www.boost.org/doc/libs/1_63_0/libs/type_traits/doc/html/boost_typetraits/reference/function_traits.html" rel="nofollow noreferrer">arity</a> from function traits for this) i.e. support for functions <strong>and</strong> function objects. </p>
  
  <p>I'm translating <a href="https://functionalcpp.wordpress.com/2013/08/05/function-traits/" rel="nofollow noreferrer">this</a> lovely post to C++03 (remove <code>...</code> and <code>using</code> typedefs) but it doesn't seem to work. </p>
  
  <p>PS. I'm not solving the particular problem listed above, that's just the <a href="http://sscce.org/" rel="nofollow noreferrer">sscce</a>. Also I mention C++03 because I'm working on legacy code for this project and a modern solution is of no use to me. By all means feel free to post a modern one but please consider helping me as well. </p>