mirror of
https://github.com/dlang/phobos.git
synced 2025-05-03 08:30:33 +03:00
splitter ddoc and constraint improvements.
splitter requires a sliceable range, contradicting the ddoc. Additionally, one of the overloads requires a sliceable range, but omits this from the if-constraint. This commit mentions the sliceable constraint in the ddoc and tightens the constraints of the overload to require slicing.
This commit is contained in:
parent
5b82debffb
commit
035eddda46
1 changed files with 4 additions and 3 deletions
|
@ -1898,7 +1898,7 @@ void swapFront(R1, R2)(R1 r1, R2 r2)
|
|||
// splitter
|
||||
/**
|
||||
Splits a range using an element as a separator. This can be used with
|
||||
any range type, but is most popular with string types.
|
||||
any sliceable range type, but is most popular with string types.
|
||||
|
||||
Two adjacent separators are considered to surround an empty element in
|
||||
the split range.
|
||||
|
@ -2138,10 +2138,11 @@ unittest
|
|||
|
||||
/**
|
||||
Splits a range using another range as a separator. This can be used
|
||||
with any range type, but is most popular with string types.
|
||||
with any sliceable range type, but is most popular with string types.
|
||||
*/
|
||||
auto splitter(Range, Separator)(Range r, Separator s)
|
||||
if (is(typeof(Range.init.front == Separator.init.front) : bool))
|
||||
if (is(typeof(Range.init.front == Separator.init.front) : bool)
|
||||
&& (hasSlicing!Range || isNarrowString!Range))
|
||||
{
|
||||
static struct Result
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue