Boost logo

Boost Users :

Subject: Re: [Boost-users] [bind][function] Newbie finds errors, but in Boost or between chair and keyboard?
From: Jeroen N. Witmond (jnw_at_[hidden])
Date: 2009-01-06 16:07:47


Steven Watanabe <watanabesj <at> gmail.com> writes:
> boost::function1<bool, int> is a unary function object. You can't call
> it with no arguments.
> What you meant is probably
> boost::function0<bool>.

Just goes to show that I'm also a newbie in interpreting this kind of compiler
error messages. :) The code I posted was an attempt at a testcase for the actual
problem I had. Your answer pointed me in the right direction to solve this.

> > // But replacing one_arg_f by its value fails to compile:
> > // /usr/include/boost/bind.hpp:413: error: invalid use of void
> > // expression
> > boost::bind(&anything::operator(), &something, _1, _2,
> > boost::bind(&anything::one_arg, &something, _1, 80235))
> > (12345, 67890);
> >
>
> Nested binds are treated specially. The above tries to invoke:
> something(12345, 67890, something.one_arg(12345, 80235));
>
> Try using protect on the inner bind:
> boost::protect(boost::bind(&anything::one_arg, &something, _1, 80235)))

I'll keep it in mind.

Thanks for your quick and helpful reply.

Jeroen.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net