
I have code which calls unary_function with the count_if() algorithm. Like this: class do_hasContainerBlock : public unary_function<BlockData*, bool> { public: bool operator() (BlockData* bd) { return bd->isContainer(); } }; bool hasContainerBlock(list<BlockData*>& bdl) { int count = count_if (bdl.begin(), bdl.end(), do_hasContainerBlock()); return (count > 0); } And I would like to replace the unary function with boost bind library, like this: int count = count_if (bdl.begin(), bdl.end(), bind( &BlockData::isContainer, _1) ); But this code does not copmile,I get this error: g++ -O0 -g3 -Wall -c -fmessage-length=0 -oBlockDataUtils.o ../BlockDataUtils.cpp ../BlockDataUtils.cpp: In function âbool hasContainerBlock(BlockDataList&)â: ../BlockDataUtils.cpp:95: error: no matching function for call to âbind(<unknown type>, const boost::lambda::lambda_functor<boost::lambda::placeholder<1>
&)â
Can you please tell me how to fix that? __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com