How do i write a pointer-to-member-function with std::function?
<p>I know how to declare <code>int fn(double)</code> inside of std::function (<code>std::function&lt;int(double)&gt;</code>). I know how to write a pointer-to-member-function (<code>typedef int (A::*MemFn)(double d);</code>). But how do i write a pointer-to-member-function with std::function?</p>

<p>Dummy code if you feel like compiling/testing  </p>

<p>-edit- based on answers i think i'll just use the typedef and not bother with std::function</p>

<pre><code>#include &lt;cstdio&gt;
#include &lt;functional&gt;

struct A{ int fn(double){ return 0; } };
int fn2(double){ return 0; }

typedef int (A::*MemFn)(double d);
typedef std::function&lt;int(double)&gt; MemFn2;

void Test(A*a, MemFn2 fn){
    fn(1.2f);
}
void Test(A*a, MemFn fn){
    (a-&gt;*fn)(1.2f);
}

int main(){
    Test(new A, &amp;A::fn);
    Test(new A, &amp;fn2);
}
</code></pre>
