Re: stdio.lines doesn't have popFront, but works with foreach

2014-12-11 Thread Andrew Klaassen via Digitalmars-d-learn
On Thursday, 11 December 2014 at 20:37:09 UTC, Kapps wrote: Ranges are one way of allowing foreach. The other is through the use of opApply, which is what std.stdio.lines does. http://dlang.org/statement.html#ForeachStatement Ah, so I just needed to keep reading down a few lines in the forea

Re: stdio.lines doesn't have popFront, but works with foreach

2014-12-11 Thread Steven Schveighoffer via Digitalmars-d-learn
On 12/11/14 3:21 PM, Andrew Klaassen wrote: On Thursday, 11 December 2014 at 20:17:50 UTC, bearophile wrote: Andrew Klaassen: The docs for stdio.lines say that it's a struct. stdio.lines works with foreach. If you want a range use "myfile".File.byLine or "myfile".File.byLineCopy. Bye, bear

Re: stdio.lines doesn't have popFront, but works with foreach

2014-12-11 Thread Kapps via Digitalmars-d-learn
On Thursday, 11 December 2014 at 20:11:21 UTC, Andrew Klaassen wrote: The docs for stdio.lines say that it's a struct. stdio.lines works with foreach. The docs for foreach say: "Iteration over struct and class objects can be done with ranges. For foreach, this means the following properties

Re: stdio.lines doesn't have popFront, but works with foreach

2014-12-11 Thread Andrew Klaassen via Digitalmars-d-learn
On Thursday, 11 December 2014 at 20:17:50 UTC, bearophile wrote: Andrew Klaassen: The docs for stdio.lines say that it's a struct. stdio.lines works with foreach. If you want a range use "myfile".File.byLine or "myfile".File.byLineCopy. Bye, bearophile I know that there are other ways t

Re: stdio.lines doesn't have popFront, but works with foreach

2014-12-11 Thread bearophile via Digitalmars-d-learn
Andrew Klaassen: The docs for stdio.lines say that it's a struct. stdio.lines works with foreach. If you want a range use "myfile".File.byLine or "myfile".File.byLineCopy. Bye, bearophile

stdio.lines doesn't have popFront, but works with foreach

2014-12-11 Thread Andrew Klaassen via Digitalmars-d-learn
The docs for stdio.lines say that it's a struct. stdio.lines works with foreach. The docs for foreach say: "Iteration over struct and class objects can be done with ranges. For foreach, this means the following properties and methods must be defined: .empty ... .front ... .popFront()" But