API

bearophile via Digitalmars-d digitalmars-d at puremagic.com
Mon May 5 17:31:03 PDT 2014


Adam D. Ruppe:

> I guess if it takes an input range with lengths though it could 
> just as well do alloc.make(repeat(0).take(45))

This is OK if "make" recognizes the repeat.take type statically 
and uses this information to allocate the array efficiently. In 
general such pattern recognition tricks should be more present in 
Phobos (in Haskell there is even a syntax to add them).

Bye,
bearophile


More information about the Digitalmars-d mailing list