Skip to content

Commit

Permalink
Merge pull request #4383 from JackStouffer/issue16073
Browse files Browse the repository at this point in the history
Partial Fix for Issue 16073
  • Loading branch information
schveiguy committed Jun 2, 2016
2 parents 4e387a3 + 74398e7 commit e216c10
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion std/algorithm/iteration.d
Original file line number Diff line number Diff line change
Expand Up @@ -4572,7 +4572,7 @@ if (isInputRange!R && !isInfinite!R)
static if (isRandomAccessRange!R && hasSlicing!R)
{
store[idx] = sumPairwise16!F(data);
data = data[16 .. $];
data = data[16 .. data.length];
}
else store[idx] = sumPairwiseN!(16, false, F)(data);

Expand Down
2 changes: 1 addition & 1 deletion std/algorithm/mutation.d
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ TargetRange copy(SourceRange, TargetRange)(SourceRange source, TargetRange targe
auto len = source.length;
foreach (idx; 0 .. len)
target[idx] = source[idx];
return target[len .. $];
return target[len .. target.length];
}
else
{
Expand Down
14 changes: 7 additions & 7 deletions std/algorithm/searching.d
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ if (isInputRange!(Range) && is(typeof(r.front == lPar)))
*/
BoyerMooreFinder!(binaryFun!(pred), Range) boyerMooreFinder
(alias pred = "a == b", Range)
(Range needle) if (isRandomAccessRange!(Range) || isSomeString!Range)
(Range needle) if ((isRandomAccessRange!(Range) && hasSlicing!Range) || isSomeString!Range)
{
return typeof(return)(needle);
}
Expand Down Expand Up @@ -1769,14 +1769,14 @@ if (isForwardRange!R1 && isForwardRange!R2

/// ditto
R1 find(alias pred = "a == b", R1, R2)(R1 haystack, R2 needle)
if (isRandomAccessRange!R1 && isBidirectionalRange!R2
if (isRandomAccessRange!R1 && hasLength!R1 && hasSlicing!R1 && isBidirectionalRange!R2
&& is(typeof(binaryFun!pred(haystack.front, needle.front)) : bool))
{
if (needle.empty) return haystack;
const needleLength = walkLength(needle.save);
if (needleLength > haystack.length)
{
return haystack[$ .. $];
return haystack[haystack.length .. haystack.length];
}
// @@@BUG@@@
// auto needleBack = moveBack(needle);
Expand Down Expand Up @@ -2576,7 +2576,7 @@ if (isForwardRange!R1 && isForwardRange!R2)
}

static if (isSomeString!R1 && isSomeString!R2
|| isRandomAccessRange!R1 && hasLength!R2)
|| (isRandomAccessRange!R1 && hasSlicing!R1 && hasLength!R1 && hasLength!R2))
{
auto balance = find!pred(haystack, needle);
immutable pos1 = haystack.length - balance.length;
Expand Down Expand Up @@ -2640,7 +2640,7 @@ if (isForwardRange!R1 && isForwardRange!R2)
}

static if (isSomeString!R1 && isSomeString!R2
|| isRandomAccessRange!R1 && hasLength!R2)
|| (isRandomAccessRange!R1 && hasLength!R1 && hasSlicing!R1 && hasLength!R2))
{
auto balance = find!pred(haystack, needle);
immutable pos = haystack.length - balance.length;
Expand Down Expand Up @@ -2700,7 +2700,7 @@ if (isForwardRange!R1 && isForwardRange!R2)
}

static if (isSomeString!R1 && isSomeString!R2
|| isRandomAccessRange!R1 && hasLength!R2)
|| isRandomAccessRange!R1 && hasLength!R1 && hasSlicing!R1 && hasLength!R2)
{
auto balance = find!pred(haystack, needle);
immutable pos = balance.empty ? 0 : haystack.length - balance.length + needle.length;
Expand Down Expand Up @@ -3318,7 +3318,7 @@ Range minPos(alias pred = "a < b", Range)(Range range)
pos = i;
}
}
return range[pos .. $];
return range[pos .. range.length];
}
else
{
Expand Down

0 comments on commit e216c10

Please sign in to comment.