Boost logo

Boost Users :

Subject: Re: [Boost-users] [Bind] Understanding protect
From: Igor R (boost.lists_at_[hidden])
Date: 2012-03-27 14:25:00


>> bind(f, 1);
>
>
>  Yeah, but that doesn't quite fit the bill! Ultimately I'm doing this for each member of a
> range, via std algorithm, so I need to bind a unary argument to produce a nullary function
> object, which I can then pass to an evaluation context, ie my g( ) function.
> If I've generated the function object with bind and placeholder(s), it seems there's no way to
> prevent the binding of the last placeholder from triggering evaluation, when what I require is an unevaluated nullary function object.

I don't understand why you need a placeholder there. Could you provide
a trivial example that demonstrates what you mean exactly?
Again, the following creates a nullary functor.

void f( int i )
{}
auto functor = boost::bind(&f, 12345);
// it can be now invoked:
functor();


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