id summary reporter owner description type status milestone component version severity resolution keywords cc 5645 Problem passing lambda functor to boost::bind - code does not compile anonymous Peter Dimov "I want to create lambda functor for function with more that 3 parameters. I need to access 1 param only, so I decided to use helper functor created wih boost::bind. Unfortunately code does not compile. But when I stored created lambda functor in boost::function object, it compiles fine. {{{ #include #include #include #include #include using namespace boost::lambda; boost::lambda::placeholder1_type _l1; boost::lambda::placeholder2_type _l2; boost::arg<1> _b1; boost::arg<4> _b4; class IFoo { public: virtual ~IFoo() {} virtual void bar(int a, int b, int c, int d) = 0; }; class Foo : public IFoo { public: boost::function bar_hook; void bar(int a, int b, int c, int d) { if (bar_hook) bar_hook(a, b, c, d); } }; int main() { Foo foo; int a = -1; // This works fine boost::function tmp_func = (_l2, var(a) = _l1); foo.bar_hook = boost::bind(tmp_func, _b1, _b4); // This fails to compile //foo.bar_hook = boost::bind( (_l2, var(a) = _l1), _b1, _b4 ); foo.bar(1, 2, 3, 4); std::cout << ""a = "" << a << std::endl; } }}}" Bugs closed To Be Determined bind Boost 1.45.0 Problem invalid viboes