Merge remote-tracking branch 'upstream/stable' into merge_stable

This commit is contained in:
Iain Buclaw 2023-07-02 02:10:20 +00:00
commit a3526d11dd
2 changed files with 18 additions and 2 deletions

View file

@ -1342,7 +1342,6 @@ if (isInputRange!Range && !isInfinite!Range &&
// if we only have one statement in the loop, it can be optimized a lot better // if we only have one statement in the loop, it can be optimized a lot better
static if (__traits(isSame, map, a => a)) static if (__traits(isSame, map, a => a))
{ {
// direct access via a random access range is faster // direct access via a random access range is faster
static if (isRandomAccessRange!Range) static if (isRandomAccessRange!Range)
{ {
@ -3865,6 +3864,14 @@ if (isInputRange!Range && !isInfinite!Range &&
assert(arr.maxElement!"a.val".val == 1); assert(arr.maxElement!"a.val".val == 1);
} }
// https://issues.dlang.org/show_bug.cgi?id=23993
@safe unittest
{
import std.bigint : BigInt;
assert([BigInt(2), BigInt(3)].maxElement == BigInt(3));
}
// minPos // minPos
/** /**
Computes a subrange of `range` starting at the first occurrence of `range`'s Computes a subrange of `range` starting at the first occurrence of `range`'s

View file

@ -9142,7 +9142,7 @@ public:
{ {
static if (needsEndTracker) static if (needsEndTracker)
{ {
if (poppedElems < windowSize) if (nextSource.empty)
hasShownPartialBefore = true; hasShownPartialBefore = true;
} }
else else
@ -10122,6 +10122,15 @@ public:
assert("ab cd".splitter(' ').slide!(No.withPartial)(2).equal!equal([["ab", "cd"]])); assert("ab cd".splitter(' ').slide!(No.withPartial)(2).equal!equal([["ab", "cd"]]));
} }
// https://issues.dlang.org/show_bug.cgi?id=23976
@safe unittest
{
import std.algorithm.comparison : equal;
import std.algorithm.iteration : splitter;
assert("1<2".splitter('<').slide(2).equal!equal([["1", "2"]]));
}
private struct OnlyResult(Values...) private struct OnlyResult(Values...)
if (Values.length > 1) if (Values.length > 1)
{ {