mirror of
https://github.com/dlang/phobos.git
synced 2025-04-30 23:20:29 +03:00
Merge remote-tracking branch 'upstream/stable' into merge_stable
This commit is contained in:
commit
64384cf202
1 changed files with 35 additions and 1 deletions
|
@ -391,7 +391,7 @@ if (ranges.length >= 2 &&
|
||||||
return mixin(algoFormat("tuple(%(current[%d].front%|,%))",
|
return mixin(algoFormat("tuple(%(current[%d].front%|,%))",
|
||||||
iota(0, current.length)));
|
iota(0, current.length)));
|
||||||
}
|
}
|
||||||
void popFront() scope @safe
|
void popFront() scope
|
||||||
{
|
{
|
||||||
foreach_reverse (i, ref r; current)
|
foreach_reverse (i, ref r; current)
|
||||||
{
|
{
|
||||||
|
@ -554,6 +554,40 @@ pure @safe nothrow @nogc unittest
|
||||||
foreach (pair; cartesianProduct(seq, seq)) {}
|
foreach (pair; cartesianProduct(seq, seq)) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@system unittest
|
||||||
|
{
|
||||||
|
import std.algorithm.comparison : equal;
|
||||||
|
import std.typecons : tuple;
|
||||||
|
|
||||||
|
static struct SystemRange
|
||||||
|
{
|
||||||
|
int[] data;
|
||||||
|
|
||||||
|
int front() @system @property inout
|
||||||
|
{
|
||||||
|
return data[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
bool empty() @system @property inout
|
||||||
|
{
|
||||||
|
return data.length == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void popFront() @system
|
||||||
|
{
|
||||||
|
data = data[1 .. $];
|
||||||
|
}
|
||||||
|
|
||||||
|
SystemRange save() @system
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
assert(SystemRange([1, 2]).cartesianProduct(SystemRange([3, 4]))
|
||||||
|
.equal([tuple(1, 3), tuple(1, 4), tuple(2, 3), tuple(2, 4)]));
|
||||||
|
}
|
||||||
|
|
||||||
// largestPartialIntersection
|
// largestPartialIntersection
|
||||||
/**
|
/**
|
||||||
Given a range of sorted $(REF_ALTTEXT forward ranges, isForwardRange, std,range,primitives)
|
Given a range of sorted $(REF_ALTTEXT forward ranges, isForwardRange, std,range,primitives)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue