Hello Bjorn,<br><br>Thanks for such a quick help. I works now.<br><br>Can you please further explain the usage of var and constant . <br>in the expression<br>if_(_1 < 24.000001 && _1 > 23.999999)[ cout <<"Bingo:<"<<_1<<">"]) <br>I understand "Bingo:<" is evaluated immediately, why not ">", which is not a lambda expression either, is not <br>evaluated along.<br><br>Forgive me if this question seems stupid, but I am new to Lambda, fascinated by its power, but convoluted by its mechanism yet. <br><br>Thanks.<br> <br>-----Original Message-----<br>From: tom gee [mailto:<a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:rockonedge@gmail.com">rockonedge@gmail.com</a>]<br>Subject: [Boost-users] A question about boost::lambda::if_ behavior <br><br>> Can anyone please explain this code:<br>[snip]<br><br>The problem is that the expression std::cout << constant("Bingo:<") is<br>evaluated immediately. Why? Because it's not a lambda expression. You have <br>two options that will help you turn your if-branch into a lambda expression;<br>either use boost::lambda::var or boost::lambda::constant.<br><br>Using boost::lambda::var:<br><br> std::for_each(setFinalVal.begin(),setFinalVal.end (),<br> (std::cout << _1 << " ", if_(_1 < 24.000001 && _1 > 23.999999)<br> [var(std::cout) << "Bingo:<" << _1 << ">"]));<br><br>Using boost::lambda::constant: <br><br> std::for_each(setFinalVal.begin(),setFinalVal.end(),<br> (std::cout << _1 << " ", if_(_1 < 24.000001 && _1 > 23.999999)<br> [std::cout << constant("Bingo:<") << _1 << ">"])); <br><br><br>Cheers,<br>Bjorn Karlsson