Transforming a range back to the original type?

bearophile bearophileHUGS at lycos.com
Wed May 2 15:34:08 PDT 2012


Jacob Carlborg:
> Is there a general function for transforming a range back to 
> the original type? If not, would it be possible to create one?

The newly redesigned containers in Scala language are often able 
to do this, but this has required the use of a very advanced 
static type system, that is currently not in D (maybe there are 
ways to implement it with D templates, but it will require work 
to implement).
Currently there is array.array() that turns the range into a 
dynamic array.

Probably some types/data structures will have a way to turn a 
lazy range into one of them.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list