c++ - Boost function and boost lambda -


i've seen few related questions, still puzzled. what's wrong syntax:

boost::function<int (int)> g = f; boost::function<int (int)> g2 = 2*g(boost::lambda::_1); 

i've tried boost 1.35 , 1.38 (these 2 installations have lying around) on gcc 4.3.4, , both give variations of error:

no match call '(boost::function<int ()(int)>) (const boost::lambda::lambda_functor<boost::lambda::placeholder<1> >&)' 

you can't call function placeholder directly. have use bind.

boost::function<int (int)> g2 = 2 * boost::lambda::bind(g, boost::lambda::_1); 

(example)


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -