
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(). I'm sure bind works the way it was intended. I'm more interested in whether you guys now how to achieve the effect I'm trying to achieve? Much appreciated, Pieter. Some additional context: using namespace boost; typedef function<bool ()> functor_type; struct f { bool operator()(bool b) { return !b; } }; struct g { bool operator()(bool b) { return b; } }; bool b; The effect I'm trying to achieve: b = true; b = h(); // produces !b, so b is now false b = h(); // produces !b, so b is now true (in the second case above this would produce false again because there appears to be no reference to b in h()) Pieter Op de Beeck www.visysglobal.com