Disjoint slices of an array as reference
data pulverizer
data.pulverizer at gmail.com
Thu Aug 20 04:11:41 UTC 2020
On Thursday, 20 August 2020 at 03:47:15 UTC, Paul Backus wrote:
> double[][] y;
> y ~= x[0..5];
Thanks. I might go for a design like this:
```
struct View(T){
T* data;
long[2][] ranges;
}
```
The ranges are were the slices are stored and T* (maybe even
immutable(T*)) is a pointer is to the start of the original
array. I'll use an opIndex that calculates the correct index in
the original array to obtain the right data.
More information about the Digitalmars-d-learn
mailing list