Can opDollar support a jagged 2D array?

James Blachly james.blachly at
Fri Oct 2 02:34:05 UTC 2020

Suppose I have a data structure encoding sequence lengths:

seq1: 0 1 2 ... N
seq2: 0 1 2 3 4 ... M
seq3: 0 1 ... P

I would like to write opIndex and opDollar to support the notation 
obj[seq, x .. $] to retrieve sequences.

However, given that opDollar is templated on dimension (always 1 in this 
example) and has no information calling function's context/dimension 0 
parameter, this seems impossible.

Am I missing an easy solution?

Kind regards

More information about the Digitalmars-d-learn mailing list