Permutations: Difference between revisions

Added missing in lazy D version
(Added missing in lazy D version)
Line 851:
[3, 1, 2]
[3, 2, 1]</pre>
===Faster Lazy version===
Compiled with <code>-version=permutations2_main</code> produces the same output:
<lang d>import std.algorithm, std.exception;
Line 886:
}
 
void popFront() /*pure nothrow*/ {
tot--;
if (tot > 0) {
Line 911:
return Permutations!T(items);
} unittest {
import std.bigint;
foreach (p; permutations([BigInt(1), BigInt(2), BigInt(3)]))
assert((p[0] + 1) > 0);