Boost logo

Boost Users :

From: yinglcs2_at_[hidden]
Date: 2006-02-15 17:02:44


--- Peter Dimov <pdimov_at_[hidden]> wrote:

> yinglcs2_at_[hidden] wrote:
>
> > int count = count_if (bdl.begin(), bdl.end(),
> > bind( &BlockData::isContainer, _1) );
>
> This looks like it should work, assuming
>
> bool BlockData::isContainer() const;
>
> > 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&)�?T:
> > ../BlockDataUtils.cpp:95: error: no matching
> function
> > for call to �?~bind(<unknown type>, const
> >
>
boost::lambda::lambda_functor<boost::lambda::placeholder<1>
> >> &)�?T
>
> Since you are using the _1 placeholder from the
> Lambda library, you need to
> use boost::lambda::bind as well. Currently
> boost::bind and Lambda do not
> recognize each other's placeholders (and don't
> interoperate in general).

I can't add this to my code:
using namespace boost::lambda::bind;

It said :
g++ -O0 -g3 -Wall -c -fmessage-length=0
-oBlockDataUtils.o ../BlockDataUtils.cpp
../BlockDataUtils.cpp:15: error: expected
namespace-name before ‘;’ token
../BlockDataUtils.cpp:15: error: ‘<type error>’ is
not a namespace

And I still can't get my code to compile:
code:
int count = count_if (bdl.begin(), bdl.end(), bind(
&BlockData::isContainer, _1));

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>
>&)’
make: *** [BlockDataUtils.o] Error 1

Any help is appreicate.

> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
>
http://lists.boost.org/mailman/listinfo.cgi/boost-users
>

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com


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