
27 May
2012
27 May
'12
11:22 a.m.
On Sunday, May 27, 2012 05:40 PM, Max wrote:
Hi,
I have the following code:
bool do_something_conditional(int *handle, const boost::function<bool(int)> &pred); bool pred_a(int handle); bool pred_b(int handle, int n1, int n2);
bool do_something(int *handle, int n1, int n2) { return do_something_conditional(handle, boost::bind(std::logical_and<bool>(), boost::not1(&pred_a), boost::bind(&pred_b, _1, n1, n2))); }
But it does not compile.
This should work and is probably clearer: return do_something_conditional(handle, boost::bind(std::logical_and<bool>(), !boost::bind(&pred_a, _1), boost::bind(&pred_b, _1, n1, n2))); Ben