-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users- bounces@lists.boost.org] On Behalf Of Stuart Dootson Sent: Saturday, May 19, 2007 11:23 AM To: boost-users@lists.boost.org 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.