Change foreach loop in std.algorithm.searching.find to a for-loop

This commit is contained in:
Jakob Ovrum 2015-02-05 20:09:29 +09:00
parent 449ff95df6
commit e6b0b458cc

View file

@ -1489,9 +1489,9 @@ if (isInputRange!InputRange)
else static if (!isInfinite!R && hasSlicing!R && is(typeof(haystack[cast(size_t)0 .. $]))) else static if (!isInfinite!R && hasSlicing!R && is(typeof(haystack[cast(size_t)0 .. $])))
{ {
size_t i = 0; size_t i = 0;
foreach (ref e; haystack) for (auto h = haystack.save; !h.empty; h.popFront())
{ {
if (predFun(e)) if (predFun(h.front))
return haystack[i .. $]; return haystack[i .. $];
++i; ++i;
} }