Jaakko Jarvi (jajarvi@cs.indiana.edu) wrote:
Lambda and format don't play well together, I noticed :( Here's a code that works however, with some explanation. Not pretty.
Best, Jaakko
...
format f("%-10s|") ; for_each(Foos.begin(), Foos.end(), cout << ret
(var(f) % bind(&foo::name, _1))); }
// format defines operator% as a member, which takes precedence over // % defined by lambda. Therefore one must make the format object to // be a lambda functor. var does that. // Var, however, cannot take a temporary object (it holds a reference to // the wrapped object). That's why the variable f. // ret
informs lambda about the return type of formats % operator.
OK, that is just what I was looking for, thanks!!! I tried all of those things but not in the right combination. Is there any resources (i.e. example programs or additional documentation) available for the lambda library. I have read through the test code already. Thanks,