mirror of
https://github.com/dlang/phobos.git
synced 2025-04-30 07:00:37 +03:00
Fix issue 10773.
This commit is contained in:
parent
86514b0015
commit
9fab541993
1 changed files with 13 additions and 1 deletions
|
@ -2432,7 +2432,8 @@ if (is(typeof(Range.init.front == Separator.init.front) : bool)
|
||||||
if (_frontLength != _frontLength.max) return;
|
if (_frontLength != _frontLength.max) return;
|
||||||
assert(!_input.empty);
|
assert(!_input.empty);
|
||||||
// compute front length
|
// compute front length
|
||||||
_frontLength = _input.length - find(_input, _separator).length;
|
_frontLength = (_separator.empty) ? 1 :
|
||||||
|
_input.length - find(_input, _separator).length;
|
||||||
static if (isBidirectionalRange!Range)
|
static if (isBidirectionalRange!Range)
|
||||||
if (_frontLength == _input.length) _backLength = _frontLength;
|
if (_frontLength == _input.length) _backLength = _frontLength;
|
||||||
}
|
}
|
||||||
|
@ -2607,6 +2608,17 @@ unittest
|
||||||
assert(equal(sp6, ["", ""][]));
|
assert(equal(sp6, ["", ""][]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unittest
|
||||||
|
{
|
||||||
|
// Issue 10773
|
||||||
|
auto s = splitter("abc", "");
|
||||||
|
auto expected = ["a", "b", "c"];
|
||||||
|
foreach (e; s) {
|
||||||
|
assert(e.equal(expected.front));
|
||||||
|
expected.popFront();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
auto splitter(alias isTerminator, Range)(Range input)
|
auto splitter(alias isTerminator, Range)(Range input)
|
||||||
if (is(typeof(unaryFun!(isTerminator)(ElementType!(Range).init))))
|
if (is(typeof(unaryFun!(isTerminator)(ElementType!(Range).init))))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue