|
Boost Users : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2006-07-04 14:30:42
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.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net