parameter pack to inputRange
Alex Parrill via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri May 6 05:50:43 PDT 2016
On Friday, 6 May 2016 at 05:00:48 UTC, Erik Smith wrote:
> Is there an existing way to adapt a parameter pack to an input
> range? I would like to construct an array with it. Example:
>
> void run(A...) (A args) {
> Array!int a(toInputRange(args));
> }
Use std.range.only: http://dlang.org/phobos/std_range.html#only
void run(A...)(A args) {
auto rng = only(args);
// ...
}
More information about the Digitalmars-d-learn
mailing list