Skip to content

Commit

Permalink
fix lockstep requireSameLength check
Browse files Browse the repository at this point in the history
 - which didn't checked the copy on the stack
   but the ranges in the LockStep struct
 - introduced with: 98f98a7
  • Loading branch information
MartinNowak committed Aug 24, 2011
1 parent 2342e49 commit 7de5863
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions std/range.d
Expand Up @@ -3488,7 +3488,10 @@ private string lockstepApply(Ranges...)(bool withIndex) if (Ranges.length > 0)
}

ret ~= "\t}\n";
ret ~= "\tif(_s == StoppingPolicy.requireSameLength) enforceAllEmpty();\n";
ret ~= "\tif(_s == StoppingPolicy.requireSameLength) {\n";
ret ~= "\t\tforeach(range; ranges)\n";
ret ~= "\t\t\tenforce(range.empty);\n";
ret ~= "\t}\n";
ret ~= "\treturn res;\n}";

return ret;
Expand Down Expand Up @@ -3533,12 +3536,6 @@ private:
R _ranges;
StoppingPolicy _s;

void enforceAllEmpty() {
foreach(range; _ranges) {
enforce(range.empty);
}
}

public:
this(R ranges, StoppingPolicy s = StoppingPolicy.shortest)
{
Expand Down

0 comments on commit 7de5863

Please sign in to comment.