On Friday, 6 August 2021 at 11:58:59 UTC, Paul Backus wrote:
struct MySlice(T, size_t maxLength) { private T[] payload; invariant(payload.length <= maxLength); this(T[] slice) { payload = slice; } T opIndex(size_t i) { return payload[i]; } // etc. }
```
Paul, Thanks very much for your reply. I understand only a fraction of the suggested solution. I will need to digest this a bit, and do some more background reading on templates. My initial, naive attempts to use this in a simple main() were unsuccessful. I'll keep plugging at it ... Best Regards, James