Boost logo

Boost Users :

Subject: Re: [Boost-users] Using vectors of ptrs
From: Roman Perepelitsa (roman.perepelitsa_at_[hidden])
Date: 2009-07-17 09:32:08


2009/7/17 Robert Jones <robertgbjones_at_[hidden]>

> On Fri, Jul 17, 2009 at 1:47 PM, Roman Perepelitsa <
> roman.perepelitsa_at_[hidden]> wrote:
>
>>
>> std::for_each(v.begin(), v.end(), boost::mem_fn(&A::a));
>>
>>
> Thanks Roman - I've missed a trick there!
>
> Is that also equivalent to
>
> for_each( v.begin(), v.end(), boost::bind(&A::a, _1));
>

Yes. Note that with boost::lambda::bind you would have to automatically
extract a pointer from shared_ptr, but boost::bind does it for you.

Roman Perepelitsa.



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