Boost logo

Boost Users :

From: Stephen Torri (storri_at_[hidden])
Date: 2007-05-19 11:10:25


On Sat, 2007-05-19 at 09:34 -0400, Nat Goodspeed wrote:
> > -----Original Message-----
> > From: boost-users-bounces_at_[hidden] [mailto:boost-users-
> > bounces_at_[hidden]] On Behalf Of Stephen Torri
> > Sent: Friday, May 18, 2007 9:01 PM
> > To: boost-users
> > Subject: [Boost-users] Converting loop to using boost::lambda
> > where containers has boost::shared_ptrs
> >
> > My idea was to do:
> >
> > std::for_each ( m_data.begin(),
> > m_data.end(),
> > output << (_1 ->* &Verification_Type_Info::to_String) (
> > new_indent_limit ) );
>
> [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

Append_Frame.cpp:48: error: reference to '_1' is ambiguous
/usr/include/boost/lambda/core.hpp:69: error: candidates are: const boost::lambda::placeholder1_type& boost::lambda::<unnamed>::_1
/usr/include/boost/bind/placeholders.hpp:54: error: boost::arg<1> <unnamed>::_1

Stephen


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