$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
From: Peter Dimov (pdimov_at_[hidden])
Date: 2007-07-11 11:04:28
Pieter Op de Beeck wrote:
> Hi,
>
> I would like to accomplish the following: "bind a functor to a
> reference and compose this with another functor". Ultimately I would
> like to use this composition with the reference embedded in it.
>
> If I write it like this:
>
> functor_type h = bind(f, bind(g, ref(b)));
>
> it works alright. However, in my situation the binding of g is done
> somewhere else in the program, so have:
>
> functor_type temp = bind(g, ref(b));
> ...
> functor_type h = bind(f, temp);
>
> Sadly enough this does not appear to work. I don't have a reference
> to b in h().
bind( f, temp ) calls f( temp ). If you want f( temp() ) instead, use
bind( f, bind( temp ) ).