How to use import std.algorithm.iteration.permutations?

Basile B. b2.temp at gmx.com
Sun Apr 19 20:26:26 UTC 2020


On Sunday, 19 April 2020 at 20:25:23 UTC, Basile B. wrote:
> On Sunday, 19 April 2020 at 17:57:21 UTC, David Zaragoza wrote:
>> [...]
>
> `permutation()` returns a lazy range (i.e an iterator). To turn 
> a permutation into a concrete data type use .array on each one.
>
> ---
> void test(int[] array){}
>
> void main()
> {
> 	int[] a = [1,1,2,2,3,3];
> 	foreach (p; a.permutations)
> 	{
> 		test(p.array);
> 	}
> }
> ---

forgot to put the imports:

---
import std.algorithm.iteration, std.array;
---


More information about the Digitalmars-d-learn mailing list