Transforming a range back to the original type?
Jakob Ovrum
jakobovrum at gmail.com
Fri May 4 13:05:25 PDT 2012
On Friday, 4 May 2012 at 19:17:13 UTC, Steven Schveighoffer wrote:
> This one:
>
> Collection c = new Collection();
> c = c.filter!(x => x < 3).toCollection();
>
> filter isn't a property of c, it's a range-producing function.
> So I only have to define filter once, as a range accepting,
> range producing function. And any container type, as long as
> it can produce a range, can use this as a pseudo method (via
> UFCS) to make a filtered copy of itself.
>
> -Steve
That's not a real example, that's pretty much the same example I
provided below the part you quoted.
More information about the Digitalmars-d-learn
mailing list