title: How to get in C++ a function pointer to a member function with bound variables?
body: <p>I would like to call a function <code>g</code> (from a 3rd party library) that takes as input a pointer to a function <code>f</code>. This function pointer is such that <code>f</code> itself takes some arguments.</p>
  
  <p>As my function <code>f</code> depends on data and I cannot pass (a reference to) this data as a parameter to the function <code>f</code> because I need to implement <code>f</code> using the signature that is used in the function pointer, I would like to do one of two things:</p>
  
  <ul>
  <li>implement <code>f</code> as a (non-static) member function of a class </li>
  <li>implement a helper function <code>fHelper</code> that takes additional arguments and then construct a function pointer (but not a function object) that has the signature of the function pointer used in <code>g</code> and calls <code>fHelper</code> with the additional arguments bound to specific values.</li>
  </ul>
  
  <p>A third solution that is neither thread-safe nor acceptable from the perpective of design would be to use a global variable.</p>
  
  <p>I have looked at <code>boost:bind</code> and <code>std::mem_fun</code> but do not understand if these concepts work in this setting. I would very much appreciate an instructive answer and possibly some background on how this case is usually handled.</p>