fork(2) download
  1. #include<boost/shared_ptr.hpp>
  2. #include<boost/bind.hpp>
  3. #include<boost/ref.hpp>
  4. #include<boost/bind/arg.hpp>
  5. #include<boost/function.hpp>
  6.  
  7. struct A
  8. {
  9. A(int v):value(v){}
  10. int someFun(){return value;}
  11. int someOtherFun(int v=0){return v+value;}
  12. int value;
  13. };
  14.  
  15. int main() {
  16. boost::shared_ptr<A> a(new A(42));
  17. boost::bind(&A::someOtherFun,a, _1)(1); //Error
  18. boost::bind(&A::someFun,a)();
  19. boost::function<int(int)>b(boost::bind(&A::someOtherFun,a, _1));
  20. boost::function<int()>c(boost::bind(&A::someOtherFun,a, 0));
  21. return 0;
  22. }
  23.  
  24.  
Success #stdin #stdout 0.02s 2816KB
stdin
Standard input is empty
stdout

Standard output is empty