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

David Zaragoza mclaud2000 at gmail.com
Sun Apr 19 17:57:21 UTC 2020


Hi

When I try to build the following:

import std.algorithm.iteration;

void test(int[] array);

void main()
{
	int[] a = [1,1,2,2,3,3];
	foreach (p; a.permutations)
	{
		test(p);
	}
}

I get the error:

.\permutations_example.d(10): Error: function 
permutations_example.test(int[] array) is not callable using 
argument types (Indexed!(int[], ulong[]))
.\permutations_example.d(10):        cannot pass argument p of 
type Indexed!(int[], ulong[]) to parameter int[] array

What's the proper way to obtain the array of permutations of a?

Kind regards
David


More information about the Digitalmars-d-learn mailing list