How to iterate using foreach on a class?

2013-11-01 Thread Gary Willoughby
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.

Re: How to iterate using foreach on a class?

2013-11-01 Thread simendsjo
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 b

Re: How to iterate using foreach on a class?

2013-11-01 Thread Gary Willoughby
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.

Re: How to iterate using foreach on a class?

2013-11-01 Thread Gary Willoughby
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.

Re: How to iterate using foreach on a class?

2013-11-01 Thread Jonathan M Davis
On Friday, November 01, 2013 12:30:10 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

Re: How to iterate using foreach on a class?

2013-11-01 Thread Gary Willoughby
On Friday, 1 November 2013 at 11:41:52 UTC, Jonathan M Davis wrote: On Friday, November 01, 2013 12:30:10 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 arra

Re: How to iterate using foreach on a class?

2013-11-01 Thread evilrat
On Friday, 1 November 2013 at 11:39:15 UTC, Gary Willoughby wrote: 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 t

Re: How to iterate using foreach on a class?

2013-11-01 Thread simendsjo
On Friday, 1 November 2013 at 11:41:52 UTC, Jonathan M Davis wrote: On Friday, November 01, 2013 12:30:10 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 arra

Re: How to iterate using foreach on a class?

2013-11-01 Thread John Colvin
On Friday, 1 November 2013 at 12:37:20 UTC, simendsjo wrote: 2) opSlice 3) alias this arguably these are the same in the context of the foreach loop. Both just provide direct access to the underlying array.

Re: How to iterate using foreach on a class?

2013-11-01 Thread Dmitry Olshansky
01-Nov-2013 16:43, John Colvin пишет: On Friday, 1 November 2013 at 12:37:20 UTC, simendsjo wrote: 2) opSlice 3) alias this arguably these are the same in the context of the foreach loop. Both just provide direct access to the underlying array. No quite. I'd say alias this is frankly a bad i

Re: How to iterate using foreach on a class?

2013-11-01 Thread Ali Çehreli
On 11/01/2013 08:32 AM, Dmitry Olshansky wrote: In short we have 2 ways: 1) Ranges 2) opApply As another shameless plug, those foreach methods are included in this chapter: http://ddili.org/ders/d.en/foreach_opapply.html Ali

Re: How to iterate using foreach on a class?

2013-11-01 Thread Jonathan M Davis
On Friday, November 01, 2013 19:32:35 Dmitry Olshansky wrote: > 01-Nov-2013 16:43, John Colvin пишет: > > On Friday, 1 November 2013 at 12:37:20 UTC, simendsjo wrote: > >> 2) opSlice > >> 3) alias this > > > > arguably these are the same in the context of the foreach loop. Both > > just provide di

Re: How to iterate using foreach on a class?

2013-11-01 Thread Philippe Sigaud
Ali: > As another shameless plug, those foreach methods are included in this chapter: > http://ddili.org/ders/d.en/foreach_opapply.htm OMG. I just grokked opApply. *epiphany moment* Thanks a lot, Ali! I tried to get it for *years*!

Re: How to iterate using foreach on a class?

2013-11-01 Thread Ali Çehreli
On 11/01/2013 02:28 PM, Philippe Sigaud wrote: Ali: As another shameless plug, those foreach methods are included in this chapter: http://ddili.org/ders/d.en/foreach_opapply.htm OMG. I just grokked opApply. *epiphany moment* Thanks a lot, A

Re: How to iterate using foreach on a class?

2013-11-01 Thread Philippe Sigaud
On Fri, Nov 1, 2013 at 11:15 PM, Ali Çehreli wrote: > >> You made my day! :) I can't believe that the king of D templates learned > something from my little chapter: > > > https://github.com/**PhilippeSigaud/D-templates-**tutorial > > ;-)

Re: How to iterate using foreach on a class?

2013-11-03 Thread Johannes Pfau
Am Fri, 01 Nov 2013 08:50:19 -0700 schrieb Ali Çehreli : > On 11/01/2013 08:32 AM, Dmitry Olshansky wrote: > > > In short we have 2 ways: > > 1) Ranges > > 2) opApply > > As another shameless plug, those foreach methods are included in this > chapter: > >http://ddili.org/ders/d.en/foreach_

Re: How to iterate using foreach on a class?

2013-11-03 Thread Nicolas Sicard
On Friday, 1 November 2013 at 12:37:20 UTC, simendsjo wrote: On Friday, 1 November 2013 at 11:41:52 UTC, Jonathan M Davis wrote: On Friday, November 01, 2013 12:30:10 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 c

Re: How to iterate using foreach on a class?

2013-11-05 Thread Jonathan M Davis
On Sunday, November 03, 2013 14:28:13 Nicolas Sicard wrote: > > So we basically have 4 ways..? > > 1) popFront + front > > 2) opSlice > > 3) alias this > > 4) opApply > > How about having a nested struct implementing a range interface + > a method (@property) returning it + alias this on the prope

[OT] Generating ddili.org with ddoc (was: Re: How to iterate using foreach on a class?)

2013-11-01 Thread Ali Çehreli
On 11/01/2013 03:51 PM, Philippe Sigaud wrote: > What did you use to generate your website, btw? It is a completely static web site (except the Google translate widget) that is produced by ddoc and a couple of Makefiles. The following is the Turkish readme file: https://code.google.com/p/d

Re: [OT] Generating ddili.org with ddoc (was: Re: How to iterate using foreach on a class?)

2013-11-02 Thread Philippe Sigaud
On Sat, Nov 2, 2013 at 12:08 AM, Ali Çehreli wrote: > On 11/01/2013 03:51 PM, Philippe Sigaud wrote: > > > What did you use to generate your website, btw? > > It is a completely static web site (except the Google translate widget) > that is produced by ddoc and a couple of Makefiles. This is s