0
votes

In D language, what is the shortest way to construct an array from a given range?

Let I have an iterator i. How to make an array of its elements (in order)?

1

1 Answers

4
votes

.array (from std.array).

Example:


import std.array : array;
import std.range : iota;


int[] arr = 10.iota.array;