[lamba] boost::lambda::function_adaptor<Func>::apply means what?
struct sample
{
int i;
sample(int i) : i(i) { }
bool odd() { return i % 2; }
};
template
On Mon, 12 Mar 2007 15:21:33 +0200, Boris
struct sample { int i; sample(int i) : i(i) { } bool odd() { return i % 2; } };
template
std::basic_ostream &operator<<(std::basic_ostream & ostr, sample s) { return ostr << s.i; } std::vector<sample> from; std::vector<sample> to;
from.push_back(sample(1)); from.push_back(sample(2)); from.push_back(sample(3));
std::for_each(from.begin(), from.end(), if_then(bind(&sample::odd, _1) == false, bind(&std::vector<sample>::push_back, to, _1)));
VC++ 8 displays dozens of error messages with the first one:
error C2665: 'boost::lambda::function_adaptor<Func>::apply' : none of the 2 overloads could convert all the argument types
Can anyone tell me how I need to change the lambda expression?
As usual I found the answer immediately after having sent the question - it must be &to: std::for_each(from.begin(), from.end(), if_then(bind(&sample::odd, _1) == false, bind(&std::vector<sample>::push_back, &to, _1))); Boris
participants (1)
-
Boris