From b1071559f73f58c51116691a801207238a5b68b4 Mon Sep 17 00:00:00 2001 From: monarch dodra Date: Wed, 17 Oct 2012 16:28:24 +0300 Subject: [PATCH] saving before calling walkLength --- std/algorithm.d | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/std/algorithm.d b/std/algorithm.d index ff47513ea..55d225bc5 100644 --- a/std/algorithm.d +++ b/std/algorithm.d @@ -3176,7 +3176,7 @@ if (isRandomAccessRange!R1 && isBidirectionalRange!R2 && is(typeof(binaryFun!pred(haystack.front, needle.front)) : bool)) { if (needle.empty) return haystack; - const needleLength = walkLength(needle); + const needleLength = walkLength(needle.save); if (needleLength > haystack.length) { // @@@BUG@@@ @@ -5740,7 +5740,7 @@ struct Levenshtein(Range, alias equals, CostType = size_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); foreach (i; 1 .. rows) {