|
Boost Users : |
From: Sebastian Redl (sebastian.redl_at_[hidden])
Date: 2006-03-04 20:58:02
Meryl Silverburgh wrote:
>But when I try to replace the code using boost lambda, I can't get it
>to compile. can you please tell me what am I missing?
>
>void addKey(RectList& rectList, vector<int>& keys, int value) {
>
> for_each(rectList.begin(), rectList.end(), if_then( bind (&Rect::x,
>_1) == value, deviantKey.push_back( bind (&Rect::y, _1) )));
>
>}
>
>
You're missing a bind. You need to bind the push_back call.
for_each(rectList.begin(), rectList.end(), if_then( bind( &Rect::x, _1)
== value,
bind(&std::vector<int>::push_back, deviantKey, bind( &Rect::y, _1))));
Not tested.
Sebastian Redl
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