Range Construction Pattern

"Nordlöw" per.nordlow at gmail.com
Sat Feb 22 05:34:18 PST 2014


> times = iota(3).map!(x => Clock.currTime).array;
> --

Ok here's my try so far:

auto create(alias fun)(size_t n)
{
     import std.range: iota, map;
     return n.iota.map!(n => fun);
}

Now what remains is to retstrict create to only take a fun with 
*no* input arguments and a non-void return.

How do I do that?


More information about the Digitalmars-d-learn mailing list