Permutations: Difference between revisions

Updated second D entry
(Updated first D entry)
(Updated second D entry)
Line 939:
private ulong tot;
 
this (/*in*/ T[] items) pure /*pure nothrow*/
in {
static enum string L = text(indexes.length); // impure
Line 999:
 
Permutations!(doCopy,T) permutations(bool doCopy=true, T)
(/*in*/ T[] items)
/*pure /*nothrow*/ if (isMutable!T) {
return Permutations!(doCopy, T)(items);
} unittest {
import std.bigint;
foreach (p; permutations([BigInt(1), BigInt(2), BigInt(3)]))
assert((p[0] + 1) > 0);
}
 
Line 1,011 ⟶ 1,007:
void main() {
import std.stdio, std.bigint;
foreachalias (p;B permutations!false([1,= 2, 3]))BigInt;
foreach (p; [B(1), B(2), writelnB(p3)].permutations);
alias BigInt B assert((p[0] + 1) > 0);
[1, 2, 3].permutations!false.writeln;
foreach (p; permutations!false([B(1), B(2), B(3)])) {}
[B(1), B(2), B(3)].permutations!false.writeln;
}
}</lang>