
2 Oct
2008
2 Oct
'08
11:10 p.m.
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