Boost logo

Boost Users :

Subject: Re: [Boost-users] Lambda: Accessing fields of 'var'ed variable
From: Scott McMurray (me22.ca+boost_at_[hidden])
Date: 2008-12-29 11:14:09


On Mon, Dec 29, 2008 at 03:31, Swidan, Firas <firas.swidan_at_[hidden]> wrote:
>
> for_each(idx.begin(), idx.end(), var(v)[_1].i = 1);
>
> This does not compile though, because lambda_functor has no member named i.
>

I think you always have to use bind with members:

for_each(idx.begin(), idx.end(), bind(&tr::i, var(v)[_1]) = 1);

Hope that works,
~ Scott


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