|
Boost Users : |
From: Brian Allison (brian_at_[hidden])
Date: 2005-06-30 12:12:37
Brian Allison wrote:for_each(src.begin(), src.end(), if_then( bind<bool>(&vector<Rec*>::empty, &var(dst)), bind<void>(&vector<Rec*>::push_back, &var(dst), _1) ) );isn't it equal to: if(dst.empty()) { dst.push_back(src.front()); } ? The sample is for training purposes?
for_each(src.begin(), src.end(), if_then(bind<bool>(&vector<Rec*>::empty, &var(dst)), (&var(dst) ->* &vector<Rec*>::push_back)(_1) ) );In either previous and in this case mere '&dst' should be used instead of '&var(dst)' without '(_1)' perhaps.
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