
4 Jul
2006
4 Jul
'06
6:30 p.m.
Pete Hodgson wrote:
Hi All,
I'm just getting into using boost and stl algorithms, and I'm getting some indecipherable compiler errors that I'd like some help understanding.
Here's some sample code:
[...]
typedef std::vector< boost::shared_ptr<CEgg> > tEggsVector;
//this function doesn't compile, //presumably because of the boost::not1 usage bool AllEggsHaveHatched() { tEggsVector basketOfEggs;
tEggsVector::iterator it = std::find_if( basketOfEggs.begin(), basketOfEggs.end(), boost::not1( boost::mem_fn( &CEgg::IsHatched ) ) );
not1 doesn't work well with boost::mem_fn applied to shared_ptr, but you may try !boost::bind( &CEgg::IsHatched, _1 ) instead.