title: boost::bind return a function object which is the argument for a function that requires pointer
body: <p>I am doing C++ coding on Linux about boost::bind.</p>
  
  <p>The return data type of boost::bind is a function object, which is an input argument to another function bridge_set_pound_var_func. </p>
  
  <p>But, bridge_set_pound_var_func's input argument must be a function pointer.  bridge_set_pound_var_func's interface cannot be changed. </p>
  
  <p>The code is as follows: </p>
  
  <pre><code>#include &lt;boost/bind.hpp&gt;
  #include &lt;iostream&gt;
  using namespace boost;
  
  class myA
  {
   public:
  
       int bridge_set_pound_var_func( int (*pound_var_func)(const char *, char *, void *), void *arg ) { std::cout &lt;&lt; "bridge_set_pound_func is called " &lt;&lt; std::endl ; return 0; }
   };
  
   class myC
   {
    public:
          myA *myOA;
          int func(const char * poundVar , char * t1, void * t2);
  
          int myCCall() { myOA-&gt;bridge_set_pound_func( (boost::bind(&amp;myC::func, this)), (void *)this ); return 0;}
  
   };
  
   int myC::func(const char * poundVar , char * t1, void * t2)
   {
       std::cout &lt;&lt; "myC::func is called " &lt;&lt; std::endl;
       return 1;
  
    }
  
   int main()
   {
        myC myCO ;
        myC *m1p = &amp;myCO ;
        m1p-&gt;myCCall() ;
  
        return 0 ;
   }
  
   // EOF
  </code></pre>
  
  <p>I got compile error:</p>
  
  <pre><code> error: no matching function for call to 
  
   'myA::bridge_set_pound_func(boost::_bi::bind_t&lt;int (&amp;)(const char*, char*, void*), boost::_mfi::dm&lt;int ()(const char*, char*, void*), myC&gt;, boost::_bi::list1&lt;boost::_bi::value&lt;myC*&gt; &gt; &gt;, void*)'
  
  
    note: candidates are: int myA::bridge_set_pound_func(int (*)(const char*, char*, void*), void*)
  </code></pre>
  
  <p>Any help will be appreciated. </p>
  
  <h2>And, the interface of bridge_set_pound_var_func cannot be changed because it needs to be called by many other functions.</h2>
  
  <p>This is the new code that work. But, "myC::func is called"  is not printed, why ? </p>
  
  <pre><code>#include &lt;boost/bind.hpp&gt;
  #include &lt;boost/function.hpp&gt;
  
  #include &lt;iostream&gt;
  using namespace boost;
  
  class myA
  {
   public:
  
   int bridge_set_pound_var_func( const boost::function3&lt;int, const char *, char *, void *&gt; f, void *arg )  { std::cout &lt;&lt; "bridge_set_pound_var_func is called " &lt;&lt; std::endl ; return 0; }
  
  };
  
   typedef  int (*funcPtr)(const char *, char *, void *) ;
  
   typedef boost::function0&lt;int&amp;&gt; boostBindFuncType;
  
   class myC
   {
    public:
     myA *myOA;
     int func(const char * poundVar , char * t1, void * t2);
  
     int myCCall()
     {
  
       std::cout &lt;&lt; "myCCall is called " &lt;&lt; std::endl;
       myOA-&gt;bridge_set_pound_var_func( (boost::bind(&amp;myC::func, this, _1, _2, _3)), (void *)this );
  
       return 0;
  
     }
  
   };
  
   int myC::func(const char * poundVar , char * t1, void * t2)
   {
    std::cout &lt;&lt; "myC::func is called " &lt;&lt; std::endl;
    return 1;
  
   }
  
   int main()
   {
      myC myCO ;
      myC *m1p = &amp;myCO ;
      m1p-&gt;myCCall() ;
  
     return 0 ;
   }
  </code></pre>
  
  <p>I cannot change the interface of bridge_set_pound_var_func, which is called by many other functions. Is is possible to transform boost::bind returned function object to a function pointer?</p>