Iterators for D
rm
roel.mathys at gmail.com
Mon Nov 6 13:13:11 PST 2006
Walter Bright wrote:
> Walter Bright wrote:
>> .being property returns an iterator that starts at the beginning
>
> Make that .begin
>
> Also, overloading += will be used to advance the iterator.
that would give something like this?
import std.stdio;
void main()
{
char[] s = "hello";
// += for advancing an iterator, why not ++?
for (iterator i = s.begin; i != s.end; i += 1)
writefln(s[i]);
// ??? i is an iterator or a char ???
foreach(i; s)
// extend writefln to take iterators ?
// but that would mean that it must be possible
// to determine a value from an iterator
writefln(i);
}
More information about the Digitalmars-d
mailing list