saving before calling walkLength

This commit is contained in:
monarch dodra 2012-10-17 16:28:24 +03:00
parent b20c31dbfe
commit b1071559f7

View file

@ -3176,7 +3176,7 @@ if (isRandomAccessRange!R1 && isBidirectionalRange!R2
&& is(typeof(binaryFun!pred(haystack.front, needle.front)) : bool)) && is(typeof(binaryFun!pred(haystack.front, needle.front)) : bool))
{ {
if (needle.empty) return haystack; if (needle.empty) return haystack;
const needleLength = walkLength(needle); const needleLength = walkLength(needle.save);
if (needleLength > haystack.length) if (needleLength > haystack.length)
{ {
// @@@BUG@@@ // @@@BUG@@@
@ -5740,7 +5740,7 @@ struct Levenshtein(Range, alias equals, CostType = size_t)
CostType distance(Range s, Range t) CostType distance(Range s, Range t)
{ {
auto slen = walkLength(s), tlen = walkLength(t); auto slen = walkLength(s.save), tlen = walkLength(t.save);
AllocMatrix(slen + 1, tlen + 1); AllocMatrix(slen + 1, tlen + 1);
foreach (i; 1 .. rows) foreach (i; 1 .. rows)
{ {