Any way to set len and ptr in dyn arrays?

Frank Benoit keinfarbton at
Tue Aug 8 05:49:02 PDT 2006

>> This builds a slice, which is like setting ptr/length of an array. This
>> is called slicing. Instead of Toms example, I think you can also write
>> this:
>> foo = buf[ 2 .. buf[0] * buf[1] + 2 ];
> Thanks to you also for your response. I was trying to suggest before
> that I understand how slicing ends up -- ie with ptr and len as I
> desired. I am worried about what happens while the slicing happens. I am
> worried about any gotchas.

I my understanding this is exactly like setting the ptr and length.
One side effect could be, that the compiler perhaps inserts array
boundary check. But I don't know that.

More information about the Digitalmars-d-learn mailing list