Fix early stopping PR

This commit is contained in:
Sebastian Wilzbach 2018-08-14 15:49:02 +02:00
parent 8ef426d772
commit e1d37201f7

View file

@ -948,8 +948,7 @@ public:
Flag!"each")) Flag!"each"))
cast(void) binaryFun!BinaryArgs(i, r.front); cast(void) binaryFun!BinaryArgs(i, r.front);
else else
if (binaryFun!BinaryArgs(i, r.front) == No.each) if (binaryFun!BinaryArgs(i, r.front) == No.each) return No.each;
return No.each;
r.popFront(); r.popFront();
i++; i++;
} }
@ -959,8 +958,12 @@ public:
{ {
// range interface with >2 parameters. // range interface with >2 parameters.
for (auto range = r; !range.empty; range.popFront()) for (auto range = r; !range.empty; range.popFront())
if (pred(range.front.expand) {
return No.each; static if (!is(typeof(fun(r.front.expand)) == Flag!"each"))
cast(void) fun(range.front.expand);
else
if (fun(range.front.expand)) return No.each;
}
} }
return Yes.each; return Yes.each;
} }
@ -1006,8 +1009,7 @@ public:
// opApply with >2 parameters. count the delegate args. // opApply with >2 parameters. count the delegate args.
// only works if it is not templated (otherwise we cannot count the args) // only works if it is not templated (otherwise we cannot count the args)
auto result = Yes.each; auto result = Yes.each;
auto dg(Parameters!(Parameters!(r.opApply)) params) { auto dg(Parameters!(Parameters!(r.opApply)) params)
pred(params);
{ {
static if (!is(typeof(binaryFun!BinaryArgs(i, e)) == Flag!"each")) static if (!is(typeof(binaryFun!BinaryArgs(i, e)) == Flag!"each"))
{ {
@ -1023,7 +1025,7 @@ public:
r.opApply(&dg); r.opApply(&dg);
return result; return result;
} }
return Yes.each;
} }
} }