|
Boost : |
Subject: Re: [boost] phoenix::bind
From: Joel de Guzman (joel_at_[hidden])
Date: 2008-10-02 19:10:02
Peter Dimov wrote:
>> Joel de Guzman:
>>
>>> Maybe you want:
>>>
>>> let(_a = 0)[ ++_a ]
>>
>> Maybe I do. :-)
>
> No, I don't. This compiles, but always returns 1 when invoked. I want
> the equivalent of:
>
> struct _F
> {
> int _a;
>
> _F(): _a( 0 ) {}
>
> int operator()() { return ++_a; }
> };
Oh right. A stateful variable. In the POV of the op() it's not
really a local variable, right? A local variable is more like:
struct _F
{
int operator()() { int _a = 0; return ++_a; }
};
I don't think the locals are what you want here.
Regards,
-- Joel de Guzman http://www.boostpro.com http://spirit.sf.net
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk