title: How to use boost bind with a member function
body: <p>The following code causes cl.exe to crash (MS VS2005).<br>
  I am trying to use boost bind to create a function to a calls a method of myclass:   </p>
  
  <pre><code>#include "stdafx.h"
  #include &lt;boost/function.hpp&gt;
  #include &lt;boost/bind.hpp&gt;
  #include &lt;functional&gt;
  
  class myclass {
  public:
      void fun1()       { printf("fun1()\n");      }
      void fun2(int i)  { printf("fun2(%d)\n", i); }
  
      void testit() {
          boost::function&lt;void ()&gt;    f1( boost::bind( &amp;myclass::fun1, this ) );
          boost::function&lt;void (int)&gt; f2( boost::bind( &amp;myclass::fun2, this ) ); //fails
  
          f1();
          f2(111);
      }
  };
  
  int main(int argc, char* argv[]) {
      myclass mc;
      mc.testit();
      return 0;
  }
  </code></pre>
  
  <p>What am I doing wrong?</p>