@@ -52,7 +52,7 @@ $(T2 reduce,
52
52
$(T2 splitWhen,
53
53
Lazily splits a range by comparing adjacent elements.)
54
54
$(T2 splitter,
55
- Lazily splits a range by a separator.)
55
+ Lazily splits a range by a separator, element predicate or whitespace .)
56
56
$(T2 substitute,
57
57
`[1, 2].substitute(1, 0.1)` returns `[0.1, 2]`.)
58
58
$(T2 sum,
@@ -3010,10 +3010,10 @@ if (isInputRange!Range)
3010
3010
3011
3011
/**
3012
3012
Splits a forward range into subranges in places determined by a binary
3013
- predicate.
3013
+ predicate called with adjacent elements .
3014
3014
3015
3015
When iterating, one element of `r` is compared with `pred` to the next
3016
- element. If `pred` return true, a new subrange is started for the next element.
3016
+ element. If `pred` returns true, a new subrange is started for the next element.
3017
3017
Otherwise, they are part of the same subrange.
3018
3018
3019
3019
If the elements are compared with an inequality (!=) operator, consider
@@ -3023,7 +3023,8 @@ Params:
3023
3023
pred = Predicate for determining where to split. The earlier element in the
3024
3024
source range is always given as the first argument.
3025
3025
r = A $(REF_ALTTEXT forward range, isForwardRange, std,range,primitives) to be split.
3026
- Returns: a range of subranges of `r`, split such that within a given subrange,
3026
+
3027
+ Returns: A range of subranges of `r`, split such that within a given subrange,
3027
3028
calling `pred` with any pair of adjacent elements as arguments returns `false`.
3028
3029
Copying the range currently has reference semantics, but this may change in the future.
3029
3030
@@ -3033,7 +3034,7 @@ relations.
3033
3034
*/
3034
3035
3035
3036
auto splitWhen (alias pred, Range )(Range r)
3036
- if (isForwardRange! Range )
3037
+ if (is ( typeof (binaryFun ! pred(r.front, r.front)) : bool ) && isForwardRange! Range )
3037
3038
{ import std.functional : not;
3038
3039
return ChunkByImpl! (not! pred, not! pred, GroupingOpType.binaryAny, Range )(r);
3039
3040
}
@@ -5537,9 +5538,9 @@ Returns:
5537
5538
one separator is given, the result is a range with two empty elements.
5538
5539
5539
5540
See_Also:
5540
- $(REF _splitter, std,regex) for a version that splits using a regular expression defined separator,
5541
- $(REF _split, std,array) for a version that splits eagerly and
5542
- $(LREF splitWhen), which compares adjacent elements instead of element against separator.
5541
+ - $(REF _splitter, std,regex) for a version that splits using a regular expression defined separator.
5542
+ - $(REF _split, std,array) for a version that splits eagerly.
5543
+ - $(LREF splitWhen), which compares adjacent elements instead of element against separator.
5543
5544
*/
5544
5545
auto splitter (alias pred = " a == b" ,
5545
5546
Flag! " keepSeparators" keepSeparators = No.keepSeparators,
@@ -6318,8 +6319,7 @@ Params:
6318
6319
deciding where to split the range.
6319
6320
6320
6321
Returns:
6321
- An $(REF_ALTTEXT input range, isInputRange, std,range,primitives) of slices of
6322
- the original range split by whitespace.
6322
+ A forward range of slices of the original range split by whitespace.
6323
6323
+/
6324
6324
auto splitter (alias isTerminator, Range )(Range r)
6325
6325
if (isForwardRange! Range && is (typeof (unaryFun! isTerminator(r.front))))
0 commit comments