Boost logo

Boost Users :

From: Nat Goodspeed (ngoodspeed_at_[hidden])
Date: 2007-05-19 11:56:12


> -----Original Message-----
> From: boost-users-bounces_at_[hidden] [mailto:boost-users-
> bounces_at_[hidden]] On Behalf Of Stuart Dootson
> Sent: Saturday, May 19, 2007 11:23 AM
> To: boost-users_at_[hidden]
> Subject: Re: [Boost-users] Converting loop to using boost::lambda
> where containers has boost::shared_ptrs
>
> > > [Nat] I think the construct you want will look more like
(untested):
> > >
> > > std::for_each(m_data.begin(), m_data.end(),
> > > output <<
> boost::bind(&Verification_Type_Info::to_String,
> > > _1,
> > > new_indent_limit));
> >
> > Its close but not quite. I get an error message that _1 is ambiguous
>
> Nat's using Boost.Bind, not the bind in Boost.Lambda - they both
> define _1 as a placeholder, so they clash...
>
> Using bind from Boost.Lambda, you'll need nested binds to cope with
> shared_ptr:

[Nat] Or you could explicitly qualify _1 in my version:

...boost::bind(&Verification_Type_Info::to_String,
               boost::bind::_1,
               new_indent_limit)...

I like that boost::bind() knows about shared_ptrs.


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