On Friday 09 August 2002 06:40 pm, Tom Matelich wrote:
std::vector<Landmark> v; ... std::vector<Landmark>::const_iterator iter = std::find_if(v.begin(), v.end(), boost::bind(std::equalstd::string, boost::bind(ZLandmark::Landmark::getName, _1), name_to_find));
Oh, and I guess that should be std::equal_to, right? Didn't work either though.
I'm not sure what the error message is, but to clean up the errors I see: std::vector<Landmark>::const_iterator iter = std::find_if(v.begin(), v.end(), boost::bind<bool>(std::equal_tostd::string(), boost::bind(&Landmark::getName, _1), name_to_find)); Mostly just syntactic cleanups, but the boost::bind<bool> part is important. It's required because of some MSVC quirks, and basically tells bind that the return type for the function object will be 'bool'. Otherwise, bind would try to figure out the return type on its own, and I think that requires partial specialization (not supported on current versions of MSVC). Doug