genetically modified slices - is it possible?

QAston qaston at gmail.com
Fri Nov 15 07:45:22 PST 2013


On Friday, 15 November 2013 at 15:12:23 UTC, Alexandr Druzhinin 
wrote:
> 15.11.2013 22:09, Adam D. Ruppe пишет:
>> You could make it work like this:
>>
>>        auto slice3 = array[
>>                 slice1.length + (slice1.ptr - array.ptr)
>>                 ..
>>                 (slice2.ptr - array.ptr)];
>>
>>
>> Since the slices all start into array somewhere, subtracting 
>> the
>> pointers gives their start index.
> Thank you very much! I forget about .ptr.
> What about ranges in general? They haven't .ptr.

Ranges in general are not arrays, they're objects - you can't get 
what's in between two objects.


More information about the Digitalmars-d-learn mailing list