c++ passing class method as argument to a class method with templates
<p>I'm trying to pass a class method to another class method using template, and cannot find any answer on how to do (no C++11, boost ok):</p>

<p>I simplified the core problem to :</p>

<pre><code>class Numerical_Integrator : public Generic Integrator{
    template &lt;class T&gt;
    void integrate(void (T::*f)() ){
         // f(); //already without calling  f() i get error
    }
}

class Behavior{
    void toto(){};

    void evolution(){
        Numerical_Integrator my_integrator;
        my_integrator-&gt;integrate(this-&gt;toto};
}
</code></pre>

<p>I get as error:</p>

<pre><code>error: no matching function for call to ‘Numerical_Integrator::integrate(&lt;unresolved overloaded function type&gt;)’this-&gt;toto);
note:   no known conversion for argument 1 from ‘&lt;unresolved overloaded function type&gt;’ to ‘void (Behavior::*)()’
</code></pre>

<p>Thank you.</p>

<p>Bonus: What about with arguments ?</p>

<pre><code>class Numerical_Integrator{
    template &lt;class T, class Args&gt;
    double integrate(void (T::*f)(), double a, Args arg){
         f(a, arg);
    }
}

class Behavior{
    double toto(double a, Foo foo){ return something to do};

    void evolution(){
     Foo foo;
     Numerical_Integrator my_integrator;
     my_integrator-&gt;integrate(this-&gt;toto, 5, foo};
}
</code></pre>