|
Boost Users : |
Subject: Re: [Boost-users] boost::bond and assignment
From: Peter Dimov (pdimov_at_[hidden])
Date: 2010-09-20 04:11:54
przemyslaw.sliwa wrote:
> Thank,
>
> This is true if you have a boost::shared_ptr<int> but in my case I have a
> class not an int and I want to assign a value of one of its members called
> mem,
>
> for(vector<clss>::iterator pos=tmp.begin(); pos!=tmp.end(); ++tmp)
> {
> clss& item = (*pos);
> item.mem = 1.0;
> }
>
> how this can be translated into the boost lambda or bind?
The two ways to write this with lambda are
(&*_1)->*&clss::mem = 1.0
and
bind( &clss::mem, *_1 ) = 1.0
I haven't tried either of them though.
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