Why is size_t unsigned?

Andrej Mitrovic andrej.mitrovich at gmail.com
Mon Jul 22 05:51:17 PDT 2013


On 7/22/13, JS <js.mdnq at gmail.com> wrote:
> foreach doesn't allow you to modify the index to skip over
> elements.

It does:

-----
import std.stdio;

void main()
{
    int[] x = [1, 2, 3, 4, 5];
    foreach (ref i; 0 .. 5)
    {
        writeln(x[i]);
        ++i;
    }
}
-----

Writes:
1
3
5


More information about the Digitalmars-d-learn mailing list