mirror of
https://github.com/dlang/phobos.git
synced 2025-05-01 07:30:33 +03:00
Merge pull request #879 from monarchdodra/walkSave
saving before calling walkLength
This commit is contained in:
commit
6e9cf770d8
1 changed files with 2 additions and 2 deletions
|
@ -3179,7 +3179,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@@@
|
||||||
|
@ -5743,7 +5743,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)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue