isPermutation

fnbool isPermutation(Flag!"allocateGC" allocateGC, Range1, Range2)(Range1 r1, Range2 r2) if (allocateGC == Yes.allocateGC && isForwardRange!Range1 && isForwardRange!Range2 && !isInfinite!Range1 && !isInfinite!Range2)

Checks if both ranges are permutations of each other.

This function can allocate if the Yes.allocateGC flag is passed. This has the benefit of have better complexity than the Yes.allocateGC option. However, this option is only available for ranges whose equality can be determined via each element's toHash method. If customized equality is needed, then the pred template parameter can be passed, and the function will automatically switch to the non-allocating algorithm. See binaryFun for more details on how to define pred.

Non-allocating forward range option: n^2 Non-allocating forward range option with custom pred: n^2 Allocating forward range option: amortized r1.length + r2.length

Parameters

predan optional parameter to change how equality is defined
allocateGCYes.allocateGC/No.allocateGC
r1A finite forward range
r2A finite forward range

Returns

true if all of the elements in r1 appear the same number of times in r2.

Otherwise, returns false.

fnbool isPermutation(alias pred = "a == b", Range1, Range2)(Range1 r1, Range2 r2) if (is(typeof(binaryFun!(pred))) && isForwardRange!Range1 && isForwardRange!Range2 && !isInfinite!Range1 && !isInfinite!Range2)

ditto