Boost logo

Boost Users :

From: BRIDGES Dick (Dick.Bridges_at_[hidden])
Date: 2005-10-06 15:07:57


> -----Original Message-----
> From: boost-users-bounces_at_[hidden]
> [mailto:boost-users-bounces_at_[hidden]] On Behalf Of Simon Buchan
> Sent: Wednesday, October 05, 2005 9:49 PM
> To: boost-users_at_[hidden]
> Subject: Re: [Boost-users] [bind] Member fn has defeated me
>
>
> BRIDGES Dick wrote:
> <snip>
> >
<snip>
> You find it mysterious because it's not even slightly common
> outside of
> functional languages. (I hope Boost can change this).
> Basicly: bind is
> a function that creates a function (sortof) from a function and
> arguments. Confused? Don't worry, that's normal. Essentially:
>
> bind(&X::f, &x, _1);
>
> is the same as:
>
> f_result_type bound_f(f_arg1_type arg1)
> { return x.f(arg1);
> }
>
> // ...
>
> &bound_f
>
> but with less hassles (ie. x can be local)

If I could start with a "bound" x, I probably wouldn't have so much
trouble with the concept. I get confused when trying to deal with the
implied 'this' when starting from the bind(&X::f, _1, _2) form. In the
current case [i.e., void f(bool)], I think _2 represents the bool
parameter and can't figure out how to express the unbound 'this'.
Clearly there is an error in my understanding of the underlying concept.


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