slice based on base and width

Simen Kjaeraas simen.kjaras at gmail.com
Sun Sep 8 05:08:31 PDT 2013


On 2013-09-08, 14:02, Chang Long wrote:

> On Sunday, 8 September 2013 at 10:53:23 UTC, Øivind wrote:
>>
>>>  a[c -: d]   //D: a[c-d .. c]
>>
>> I think this should be
>>
>> a[c -: d]   //D: a[c-d+1 .. c+1],  e.g. a[5 -: 2] == [a[4], a[5]]
>
>
> try &a[base][0..width]

That throws safety out the window for one. If you want safety and
no new language features, this should work:

   a[base..$][0..width]

-- 
   Simen


More information about the Digitalmars-d mailing list