Boost logo

Boost :

From: Giovanni Bajo (giovannibajo_at_[hidden])
Date: 2002-07-09 15:54:59


----- Original Message -----
From: "Mac Murrett" <mmurrett_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Tuesday, July 09, 2002 9:59 PM
Subject: Re: [boost] Re: shared_ptr and ->*

> struct C
> {
> foo();
> };
>
> vector<shared_ptr<C> > v;
> ...
> for_each(v.begin(), v.end(), mem_fun(&C::foo));
>
> ... or am I missing something?

for_each(v.begin(), v.end(), bind(&C::foo, _1));

mem_fun is obsoleted by bind. Notice also that it's the same syntax that you
would have used for a vector<C*> or even a vector<C>.

Giovanni Bajo


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk