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:
http://www.digitalmars.com/d/2.0/phobos/.html#slice

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?

Bye,
bearophile
Sep 25 2010