www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - opStaticSlice

The std.typecons.Tuple has a slice() method, in this case opSlice() can't be
used because the bounds must be known at compile-time:

On the other hand you are allowed to slice a TypeTuple using the normal
[start..stop] syntax, and start & stop must be known at compile-time.

Isn't it possible to add an operator to support the normal slicing syntax at
compile-time? Something like a opStaticSlice(size_t start, size_t stop)() {}
that is usable with the [start..stop] syntax.

Even if a similar operator is doable, is this a common enough need for
user-defined data structures (like  fixed-sized slicing of a fixed
sized-matrix) to justify a new operator?

Sep 25 2010