mirror of
https://github.com/dlang/phobos.git
synced 2025-05-03 16:40:48 +03:00
Merge pull request #2838 from Poita/Issue13124
Fix Issue 13124 - Allow non-bool predicates for until
This commit is contained in:
commit
e8e452862f
1 changed files with 8 additions and 2 deletions
|
@ -6875,9 +6875,9 @@ struct Until(alias pred, Range, Sentinel) if (isInputRange!Range)
|
||||||
private bool predSatisfied()
|
private bool predSatisfied()
|
||||||
{
|
{
|
||||||
static if (is(Sentinel == void))
|
static if (is(Sentinel == void))
|
||||||
return unaryFun!pred(_input.front);
|
return cast(bool) unaryFun!pred(_input.front);
|
||||||
else
|
else
|
||||||
return startsWith!pred(_input, _sentinel);
|
return cast(bool) startsWith!pred(_input, _sentinel);
|
||||||
}
|
}
|
||||||
|
|
||||||
void popFront()
|
void popFront()
|
||||||
|
@ -6992,6 +6992,12 @@ unittest // bugzilla 13171
|
||||||
assert(equal(a, [0, 0, 3, 4]));
|
assert(equal(a, [0, 0, 3, 4]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unittest // Issue 13124
|
||||||
|
{
|
||||||
|
auto s = "hello how\nare you";
|
||||||
|
s.until!(c => c.among!('\n', '\r'));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Checks whether the given $(XREF2 range, isInputRange, input range) starts with
|
Checks whether the given $(XREF2 range, isInputRange, input range) starts with
|
||||||
(one of) the given needle(s).
|
(one of) the given needle(s).
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue