Transforming a range back to the original type?
Jacob Carlborg
doob at me.com
Fri May 4 12:18:56 PDT 2012
On 2012-05-04 18:32, Jakob Ovrum wrote:
> After a quick look over the thread again, I still don't see any real
> examples of use cases from Jacob (I admit I could still be missing it...
> somewhere...).
I can't recall I ever had a use case where I wanted to do some operation
on a collection and then transforming it to another type of collection.
I just want to perform the operation, then get back a collection of the
same type:
int[] a = [3, 4, 5, 6 ,7];
a = a.filter!(x => x < 6);
Since that's not possible with the way ranges are designed I was
thinking if it at least would be possible to have a generic interface to
get the a collection (of the same type) out of the range.
--
/Jacob Carlborg
More information about the Digitalmars-d-learn
mailing list