On Aug 10, 2005, at 1:47 PM, Simmons, Aaron wrote:
Alan's post made me realize what's happening. Indeed, this last bind() doesn't know that funcFoo and funcBar are functions that it should call. You can tell it to consider them as functions by calling bind() on them:
Rather than wrapping another bind around them, is it possible to do some kind of clever casting, so that bind wouldn't see them as booleans?
Not that I can think of.
Btw, is the way I'm using function and bind not an intended use case? It seems natural enough, but by its behavior perhaps no one thought about it before...
We typically advise users to keep their bind() expressions together and put the result into a function<> at the end, to minimize the performance degradation associated with function<>. In that sense, it's somewhat unexpected. I'd like to hear Peter Dimov's take on this one. My gut reaction is that what you wrote should probably work, e.g., function<> objects should be recognized as nested bind expressions. Doug