How to iterate using foreach on a class?
Gary Willoughby
dev at nomad.so
Fri Nov 1 04:36:20 PDT 2013
On Friday, 1 November 2013 at 11:35:03 UTC, simendsjo wrote:
> On Friday, 1 November 2013 at 11:30:12 UTC, Gary Willoughby
> wrote:
>> I have a class which contains an array as a core collection of
>> data. I want to pass an instance of this class to a foreach
>> loop and iterate through the enclosed array. How do i do this?
>> I've asked this before and got an answer but i can't find
>> anything now.
>
> alias this on the underlying array, or implement opApply:
> http://dlang.org/statement.html
Ah that's it, opApply! ta.
More information about the Digitalmars-d-learn
mailing list