11 Jul
2007
11 Jul
'07
3:04 p.m.
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 ) ).