From: tom gee [mailto:rockonedge@gmail.com]
Can you please further explain the usage of var and constant . in the expression if_(_1 < 24.000001 && _1 > 23.999999)[ cout <<"Bingo:<"<<_1<<">"]) I understand "Bingo:<" is evaluated immediately, why not ">", which is not a lambda expression either, is not evaluated along.
Actually it is a lambda expression! The reason is the preceding streaming of _1, which implicitly marks the expression as a lambda expression. So, std::cout << "Bingo:<" is not a lambda expression, and is thus evaluated immediately. The last part of the expression is a lambda expression, _1 << ">" (or rather std::cout << _1 << ">"), but it won't be invoked. See http://tinyurl.com/7jq3v for details on how to use constant and var.
Forgive me if this question seems stupid, but I am new to Lambda, fascinated by its power, but convoluted by its mechanism yet.
The question isn't stupid, and you're more than welcome to keep asking. And I agree that Boost.Lambda's power is fascinating. Bjorn Karlsson