streaming redux

Steven Schveighoffer schveiguy at yahoo.com
Mon Jan 3 13:02:20 PST 2011


On Mon, 03 Jan 2011 15:33:10 -0500, so <so at so.do> wrote:

>> type of (&i)[0..1] is int[]
>
> I see what the topic is all about.
> The trouble is this syntax. You say it is int[], but i couldn't find  
> anything in D reference that explains this.
> Sorry if i am overlooking something.
>

Oh that:

http://www.digitalmars.com/d/2.0/arrays.html#slicing

quoted from there:


Slicing is not only handy for referring to parts of other arrays, but for  
converting pointers into bounds-checked arrays:

    int* p;
    int[] b = p[0..8];

The type of &i is int*, so there you go.

-Steve


More information about the Digitalmars-d mailing list