On 10/06/2016 04:32 PM, Nordlöw wrote:
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`?
https://dlang.org/phobos/std_container_util.html#.make
----
import std.container.array: Array;
import std.container.util: make;
import std.range: iota;
void main()
{
auto arr = 0.iota(99).make!Array;
}
----