Boost logo

Boost Users :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2004-09-01 14:11:28


Maximilian Wilson wrote:
> I am getting another compiler error when trying to use the lambda
> library. Current experiment is string extraction. I'm trying to create
> a lambda(x) that pushes any char passed to it onto a particular
> string.
>
> string s2;
> void (std::string::*ft)(char) = &std::string::push_back;
> // extract function pointer because push_back is overloaded
> char c = 'n';
> bind<void>(ft, var(s2), _1, 1)(c);

    bind( ft, var(s2), _1 )( c );

ft has two arguments, 'this' and a char. No need for the trailing '1'.

Try

    (s2 += _1)( c );

too.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net