How to convert a function that returns a int to a function that returns a bool using boost::bind?

Posted by user814628 on Stack Overflow See other posts from Stack Overflow or by user814628
Published on 2012-12-11T22:50:36Z Indexed on 2012/12/11 23:03 UTC
Read the original article Hit count: 268

Filed under:
|
|

I have something like the following:

 struct A{
  virtual int derp(){ 
      if(herp()) return 1; 
      else return 0; 
   }
  void slurp(){
    boost::function<bool(int x, int y> purp = /** boost bind derp to match lvalue sig  **/;
  }
 }

Any ideas? I want to create the function prup which basically calls derp and ignores the (x,y) passed in.

I need something like

bool purp(int x, int y){ return derp(); }

but want to avoid creating it as a member function, and rather just create it locally if possible?

© Stack Overflow or respective owner

Related posts about c++

Related posts about boost