title: Calling a C++ function pointer on a specific object instance
body: <p>I have a function pointer defined by:</p>
  
  <pre><code>typedef void (*EventFunction)(int nEvent);
  </code></pre>
  
  <p>Is there a way to handle that function with a specific instance of a C++ object?</p>
  
  <pre><code>class A
  {
  private:
      EventFunction handler;
  
  public:
      void SetEvent(EventFunction func) { handler = func; }
  
      void EventOne() { handler(1); }
  };
  
  class B
  {
  private:
      A a;
  public:
      B() { a.SetEvent(EventFromA); }  // What do I do here?
  
      void EventFromA(int nEvent) { // do stuff }
  };
  </code></pre>
  
  <p><strong>Edit:</strong> Orion pointed out the options that Boost offers such as:</p>
  
  <pre><code>boost::function&lt;int (int)&gt; f;
  X x;
  f = std::bind1st(
        std::mem_fun(&amp;X::foo), &amp;x);
  f(5); // Call x.foo(5)
  </code></pre>
  
  <p>Unfortunately Boost is not an option for me.  Is there some sort of "currying" function that can be written in C++ that will do this kind of wrapping of a pointer to a member function in to a normal function pointer?</p>