foreach reference to struct variable
Don Clugston
dac at nospam.com.au
Fri Feb 8 06:17:07 PST 2008
Prashant V wrote:
> Denton Cockburn Wrote:
>> use ref while indexing:
>>
>> foreach (ref s; structs)
>> // do something
>
> Ah that works great! Thanks. Is there anything similar for variables. Eg can I go
>
> int test = 5;
> ref auto test2 = test;
> test++;
>
> and have the change reflected in test?
Not at present, but IIRC it is an intended future feature (with syntax exactly
as you've written).
More information about the Digitalmars-d
mailing list