Peter Barker:
void LambdaBind() { std::auto_ptr<GridItem> item(new GridItem()); std::vector<std::string> options;
using namespace boost::lambda; using boost::lambda::_1; std::for_each(options.begin(),options.end(),
bind(GridItem::AddOption,boost::ref(item),bind(std::string::c_str,_1),true)); // COMPILE ERROR ON ABOVE }
int main() { }
The error is: c:\releases\lib\boost\boost_1_35_0\include\boost\bind.hpp(338) : error C2664: 'R boost::_mfi::mf2<R,T,A1,A2>::operator ()<std::auto_ptr<_Ty>>(const U &,A1,A2) const' : cannot convert parameter 2 from 'boost::lambda::lambda_functor<T>' to 'const char *'
Since you use an unqualified call to bind, argument-dependent lookup finds boost::bind and prefers it as a better match. Nasty. You need '&' in front of the member functions, by the way. Omitting it is a MSVC-ism.