Rust-like collect in D

Nordlöw via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Oct 6 07:32:44 PDT 2016


Is there a concept in D similar to Rust's `collect`:

https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.collect

If not, I'm eager to implement it to support D-style containers.

What would the desired interface look like?

Perhaps:

     0.iota(n).collect!Array

Or can/should we just overload `std.conv.to` as

     0.iota(n).to!Array

eventhough the element type is not explicit in the expression 
`to.!Array`?


More information about the Digitalmars-d-learn mailing list