14 Mar
2007
14 Mar
'07
9:15 p.m.
"Peng Yu"
I'm made up the following example. But it's not working. Could you please show me how to make it work?
#include
#include #include <iostream> using namespace boost::lambda;
int main() { std::cout << (_1 + _2)(10, 10) << std::endl; }
The function object -- the result of _1 + _2 -- requires T&, and therefore you can't pass constants to it. The following will work: int n1 = 10; int n2 = 10; cout << (_1 + _2)(n1, n2) << endl; HTH, Arkadiy