Rust-like collect in D
    Dicebot via Digitalmars-d-learn 
    digitalmars-d-learn at puremagic.com
       
    Thu Oct  6 10:22:10 PDT 2016
    
    
  
On Thursday, 6 October 2016 at 16:56:26 UTC, Nordlöw wrote:
> Is there a way to do this, or do we need something similar to 
> `collect` in Phobos? Something like
>
> import std.container.array : Array;
>
> 0.iota(n).collect!Array
You mean semantics like this?
Container collect(Container, Range) (Range r)
     if(isOutputRange!Container)
{
     Container container;
     r.copy(container);
     return container;
}
    
    
More information about the Digitalmars-d-learn
mailing list