Boost logo

Boost Users :

From: Shawn Church (sl_church_at_[hidden])
Date: 2004-01-29 15:05:19


Jaakko Jarvi (jajarvi_at_[hidden]) 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<format&>(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<format&> 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,


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net