11 Jul
2008
11 Jul
'08
11:40 p.m.
#include
#include #include int main() { using namespace boost::lambda; typedef boost::function< double() > F0arg; boost::function< double() > arg1, arg2; const double x1=1.1, x2=2.2; F0arg f = bind(protect(_1*_2), x1, x2); boost::function< double() > func1(f), func2(f); F0arg f2 = bind(protect(_1*_2), bind(func1), bind(func2)); }
Any explanation as to why this works and the previous example does not? It seems that the line of code:
boost::function< double() > func1(f), func2(f); is redundant with F0arg f = bind(protect(_1*_2), x1, x2); isn't it? (Clearly not, since it compiles while the earlier version did not)
Jame