mirror of
https://github.com/dlang/phobos.git
synced 2025-05-05 01:20:40 +03:00
saving before calling walkLength
This commit is contained in:
parent
b20c31dbfe
commit
b1071559f7
1 changed files with 2 additions and 2 deletions
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue