0

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)?

porton
  • 5,214
  • 11
  • 47
  • 95

1 Answers1

4

.array (from std.array).

Example:


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


int[] arr = 10.iota.array;
greenify
  • 1,127
  • 8
  • 7