
12 Mar
2007
12 Mar
'07
7:21 a.m.
struct sample { int i; sample(int i) : i(i) { } bool odd() { return i % 2; } }; template <class T, class U> std::basic_ostream<T, U> &operator<<(std::basic_ostream<T, U>& 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? Thanks, Boris