title: How to get a function pointer from lambda expressions or so?
body: <p>I have a C language function to be called:</p>
  
  <pre><code>f_api(void(*callback)(int))
  </code></pre>
  
  <p>and I have a static class method for the callback:</p>
  
  <pre><code>struct A {
      static void CallBack(int i) {
          A::count = i;
      }
      static count = 0;
  };
  </code></pre>
  
  <p>I can call the function like this:</p>
  
  <pre><code>f_api(&amp;A::CallBack)
  </code></pre>
  
  <p>However, I have to change the callback to non-static now, because I have to create multiple <code>A</code> objects.</p>
  
  <p>But I cannot change the definition of <code>f_api()</code>.</p>
  
  <p>I tried using a lambda:</p>
  
  <pre><code>f_api([this](int i)-&gt;void{this-&gt;count = i;})`
  </code></pre>
  
  <p>But this failed, because I cannot convert a lambda with capture into a simple function pointer.</p>
  
  <p><code>std::bind()</code> also cannot do the work, because of the <code>f_api()</code> definition.</p>
  
  <p>What can I do for this?  How can I get a function pointer from a lambda expression? Is there any method to sidestep?</p>