Invalid foreach aggregate

Chris via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Nov 16 08:55:28 PST 2015


On Monday, 16 November 2015 at 16:49:19 UTC, Marc Schütz wrote:
> On Monday, 16 November 2015 at 16:44:27 UTC, Chris wrote:
>> Updating my code from 2.067.1 to 2.069.1 (I skipped 2.068, 
>> because I was too busy).
>>
>> I get this error:
>>
>> invalid foreach aggregate, define opApply(), range primitives, 
>> or use .tupleof
>>
>> for code like
>>
>> foreach (ref it; myArray.doSomething) {}
>>
>> Probably not the best idea anyway. What's the best fix for 
>> this? Thanks.
>
> Well, what does `doSomething` return?

It returns a range that modifies individual items in myArray, 
i.e. it assigns values to fields in each item of the array.


More information about the Digitalmars-d-learn mailing list