mirror of
https://github.com/dlang/phobos.git
synced 2025-05-02 08:00:48 +03:00
fix package XREFs
Also add escaping underscores in some places, and rewrap to 80 columns where touching anyway.
This commit is contained in:
parent
559038b363
commit
b28962635f
19 changed files with 255 additions and 189 deletions
|
@ -129,7 +129,7 @@ $(D cache) does not provide random access primitives,
|
|||
as $(D cache) would be unable to cache the random accesses.
|
||||
If $(D Range) provides slicing primitives,
|
||||
then $(D cache) will provide the same slicing primitives,
|
||||
but $(D hasSlicing!Cache) will not yield true (as the $(XREF range,hasSlicing)
|
||||
but $(D hasSlicing!Cache) will not yield true (as the $(XREF_PACK _range,primitives,hasSlicing)
|
||||
trait also checks for random access).
|
||||
+/
|
||||
auto cache(Range)(Range range)
|
||||
|
@ -1295,7 +1295,8 @@ defaults to $(D "a == b").
|
|||
|
||||
Params:
|
||||
pred = Binary predicate for determining equivalence of two elements.
|
||||
r = The $(XREF2 range, isInputRange, input range) to iterate over.
|
||||
r = The $(XREF_PACK_NAMED range,primitives,isInputRange,input range) to
|
||||
iterate over.
|
||||
|
||||
Returns: A range of elements of type $(D Tuple!(ElementType!R, uint)),
|
||||
representing each consecutively unique element and its respective number of
|
||||
|
@ -1680,8 +1681,8 @@ unittest
|
|||
* they appear in the original range.
|
||||
*
|
||||
* See_also:
|
||||
* $(XREF algorithm,group), which collapses adjacent equivalent elements into a
|
||||
* single element.
|
||||
* $(LREF group), which collapses adjacent equivalent elements into a single
|
||||
* element.
|
||||
*/
|
||||
auto chunkBy(alias pred, Range)(Range r)
|
||||
if (isInputRange!Range)
|
||||
|
@ -1891,10 +1892,10 @@ is a range. If you do not provide a separator, then the ranges are
|
|||
joined directly without anything in between them.
|
||||
|
||||
Params:
|
||||
r = An $(XREF2 range, isInputRange, input range) of input ranges to be
|
||||
joined.
|
||||
sep = A $(XREF2 range, isForwardRange, forward range) of element(s) to
|
||||
serve as separators in the joined range.
|
||||
r = An $(XREF_PACK_NAMED range,primitives,isInputRange,input range) of input
|
||||
ranges to be joined.
|
||||
sep = A $(XREF_PACK_NAMED range,primitives,isForwardRange,forward range) of
|
||||
element(s) to serve as separators in the joined range.
|
||||
|
||||
Returns:
|
||||
An input range of elements in the joined range. This will be a forward range if
|
||||
|
@ -2853,8 +2854,8 @@ below).
|
|||
Params:
|
||||
pred = The predicate for comparing each element with the separator,
|
||||
defaulting to $(D "a == b").
|
||||
r = The $(XREF2 range, isInputRange, input range) to be split. Must support
|
||||
slicing and $(D .length).
|
||||
r = The $(XREF_PACK_NAMED range,primitives,isInputRange,input range) to be
|
||||
split. Must support slicing and $(D .length).
|
||||
s = The element to be treated as the separator between range segments to be
|
||||
split.
|
||||
|
||||
|
@ -3134,9 +3135,10 @@ empty elements.
|
|||
Params:
|
||||
pred = The predicate for comparing each element with the separator,
|
||||
defaulting to $(D "a == b").
|
||||
r = The $(XREF2 range, isInputRange, input range) to be split.
|
||||
s = The $(XREF2 range, isForwardRange, forward range) to be treated as the
|
||||
separator between segments of $(D r) to be split.
|
||||
r = The $(XREF_PACK_NAMED range,primitives,isInputRange,input range) to be
|
||||
split.
|
||||
s = The $(XREF_PACK_NAMED range,primitives,isForwardRange,forward range) to
|
||||
be treated as the separator between segments of $(D r) to be split.
|
||||
|
||||
Constraints:
|
||||
The predicate $(D pred) needs to accept an element of $(D r) and an
|
||||
|
@ -3442,7 +3444,8 @@ empty elements.
|
|||
|
||||
Params:
|
||||
isTerminator = The predicate for deciding where to split the range.
|
||||
input = The $(XREF2 range, isInputRange, input range) to be split.
|
||||
input = The $(XREF_PACK_NAMED range,primitives,isInputRange,input range) to
|
||||
be split.
|
||||
|
||||
Constraints:
|
||||
The predicate $(D isTerminator) needs to accept an element of $(D input).
|
||||
|
@ -3688,8 +3691,8 @@ Params:
|
|||
s = The string to be split.
|
||||
|
||||
Returns:
|
||||
An $(XREF2 range, isInputRange, input range) of slices of the original
|
||||
string split by whitespace.
|
||||
An $(XREF_PACK_NAMED range,primitives,isInputRange,input range) of slices of
|
||||
the original string split by whitespace.
|
||||
+/
|
||||
auto splitter(C)(C[] s)
|
||||
if (isSomeChar!C)
|
||||
|
@ -3870,14 +3873,17 @@ if (isSomeChar!C)
|
|||
|
||||
// sum
|
||||
/**
|
||||
Sums elements of $(D r), which must be a finite $(XREF2 range, isInputRange, input range). Although
|
||||
Sums elements of $(D r), which must be a finite
|
||||
$(XREF_PACK_NAMED range,primitives,isInputRange,input range). Although
|
||||
conceptually $(D sum(r)) is equivalent to $(LREF reduce)!((a, b) => a +
|
||||
b)(0, r), $(D sum) uses specialized algorithms to maximize accuracy,
|
||||
as follows.
|
||||
|
||||
$(UL
|
||||
$(LI If $(D $(XREF range, ElementType)!R) is a floating-point type and $(D R) is a
|
||||
$(XREF2 range, isRandomAccessRange, random-access range) with length and slicing, then $(D sum) uses the
|
||||
$(LI If $(D $(XREF_PACK range,primitives,ElementType)!R) is a floating-point
|
||||
type and $(D R) is a
|
||||
$(XREF_PACK_NAMED range,primitives,isRandomAccessRange,random-access range) with
|
||||
length and slicing, then $(D sum) uses the
|
||||
$(WEB en.wikipedia.org/wiki/Pairwise_summation, pairwise summation)
|
||||
algorithm.)
|
||||
$(LI If $(D ElementType!R) is a floating-point type and $(D R) is a
|
||||
|
@ -4070,12 +4076,13 @@ bidirectional, $(D uniq) also yields a bidirectional range.
|
|||
|
||||
Params:
|
||||
pred = Predicate for determining equivalence between range elements.
|
||||
r = An $(XREF2 range, isInputRange, input range) of elements to filter.
|
||||
r = An $(XREF_PACK_NAMED range,primitives,isInputRange,input range) of
|
||||
elements to filter.
|
||||
|
||||
Returns:
|
||||
An $(XREF2 range, isInputRange, input range) of consecutively unique
|
||||
elements in the original range. If $(D r) is also a forward range or
|
||||
bidirectional range, the returned range will be likewise.
|
||||
An $(XREF_PACK_NAMED range,primitives,isInputRange,input range) of
|
||||
consecutively unique elements in the original range. If $(D r) is also a
|
||||
forward range or bidirectional range, the returned range will be likewise.
|
||||
*/
|
||||
auto uniq(alias pred = "a == b", Range)(Range r)
|
||||
if (isInputRange!Range && is(typeof(binaryFun!pred(r.front, r.front)) == bool))
|
||||
|
|
|
@ -446,11 +446,13 @@ $(WEB sgi.com/tech/stl/copy_backward.html, STL's copy_backward'):
|
|||
}
|
||||
|
||||
/**
|
||||
Assigns $(D value) to each element of input range $(D range).
|
||||
Assigns $(D value) to each element of input _range $(D range).
|
||||
|
||||
Params:
|
||||
range = An $(XREF2 range, isInputRange, input range) that exposes references to its elements
|
||||
and has assignable elements
|
||||
range = An
|
||||
$(XREF_PACK_NAMED _range,primitives,isInputRange,input _range)
|
||||
that exposes references to its elements and has assignable
|
||||
elements
|
||||
value = Assigned to each element of range
|
||||
|
||||
See_Also:
|
||||
|
@ -560,10 +562,11 @@ $(D range) does not have to be a multiple of the length of $(D
|
|||
filler). If $(D filler) is empty, an exception is thrown.
|
||||
|
||||
Params:
|
||||
range = An $(XREF2 range, isInputRange, input range) that exposes
|
||||
references to its elements and has assignable elements.
|
||||
filler = The $(XREF2 range, isForwardRange, forward range) representing the
|
||||
_fill pattern.
|
||||
range = An $(XREF_PACK_NAMED _range,primitives,isInputRange,input _range)
|
||||
that exposes references to its elements and has assignable elements.
|
||||
filler = The
|
||||
$(XREF_PACK_NAMED _range,primitives,isForwardRange,forward _range)
|
||||
representing the _fill pattern.
|
||||
*/
|
||||
void fill(Range1, Range2)(Range1 range, Range2 filler)
|
||||
if (isInputRange!Range1
|
||||
|
@ -680,8 +683,10 @@ Initializes all elements of $(D range) with their $(D .init) value.
|
|||
Assumes that the elements of the range are uninitialized.
|
||||
|
||||
Params:
|
||||
range = An $(XREF2 range, isInputRange, input range) that exposes references to its elements
|
||||
and has assignable elements
|
||||
range = An
|
||||
$(XREF_PACK_NAMED _range,primitives,isInputRange,input _range)
|
||||
that exposes references to its elements and has assignable
|
||||
elements
|
||||
|
||||
See_Also:
|
||||
$(LREF fill)
|
||||
|
@ -1168,9 +1173,10 @@ An exception will be thrown if this condition does not hold, i.e., there is not
|
|||
enough room in $(D tgt) to accommodate all of $(D src).
|
||||
|
||||
Params:
|
||||
src = An $(XREF2 range, isInputRange, input range) with movable elements.
|
||||
tgt = An $(XREF2 range, isInputRange, input range) with elements that
|
||||
elements from $(D src) can be moved into.
|
||||
src = An $(XREF_PACK_NAMED range,primitives,isInputRange,input range) with
|
||||
movable elements.
|
||||
tgt = An $(XREF_PACK_NAMED range,primitives,isInputRange,input range) with
|
||||
elements that elements from $(D src) can be moved into.
|
||||
|
||||
Returns: The leftover portion of $(D tgt) after all elements from $(D src) have
|
||||
been moved.
|
||||
|
@ -1218,9 +1224,10 @@ tgt) in lockstep in increasing order, calls $(D move(a, b)). Stops
|
|||
when either $(D src) or $(D tgt) have been exhausted.
|
||||
|
||||
Params:
|
||||
src = An $(XREF2 range, isInputRange, input range) with movable elements.
|
||||
tgt = An $(XREF2 range, isInputRange, input range) with elements that
|
||||
elements from $(D src) can be moved into.
|
||||
src = An $(XREF_PACK_NAMED range,primitives,isInputRange,input range) with
|
||||
movable elements.
|
||||
tgt = An $(XREF_PACK_NAMED range,primitives,isInputRange,input range) with
|
||||
elements that elements from $(D src) can be moved into.
|
||||
|
||||
Returns: The leftover portions of the two ranges after one or the other of the
|
||||
ranges have been exhausted.
|
||||
|
@ -1314,8 +1321,8 @@ In the case above the element at offset $(D 1) is removed and $(D
|
|||
remove) returns the range smaller by one element. The original array
|
||||
has remained of the same length because all functions in $(D
|
||||
std.algorithm) only change $(I content), not $(I topology). The value
|
||||
$(D 8) is repeated because $(XREF algorithm, move) was invoked to move
|
||||
elements around and on integers $(D move) simply copies the source to
|
||||
$(D 8) is repeated because $(LREF move) was invoked to
|
||||
move elements around and on integers $(D move) simply copies the source to
|
||||
the destination. To replace $(D a) with the effect of the removal,
|
||||
simply assign $(D a = remove(a, 1)). The slice will be rebound to the
|
||||
shorter array and the operation completes with maximal efficiency.
|
||||
|
@ -2217,8 +2224,10 @@ define copy constructors (for all other types, $(LREF fill) and
|
|||
uninitializedFill are equivalent).
|
||||
|
||||
Params:
|
||||
range = An $(XREF2 range, isInputRange, input range) that exposes references to its elements
|
||||
and has assignable elements
|
||||
range = An
|
||||
$(XREF_PACK_NAMED _range,primitives,isInputRange,input _range)
|
||||
that exposes references to its elements and has assignable
|
||||
elements
|
||||
value = Assigned to each element of range
|
||||
|
||||
See_Also:
|
||||
|
|
|
@ -101,7 +101,7 @@ template all(alias pred = "a")
|
|||
{
|
||||
/++
|
||||
Returns $(D true) if and only if $(I _all) values $(D v) found in the
|
||||
input range $(D range) satisfy the predicate $(D pred).
|
||||
input _range $(D range) satisfy the predicate $(D pred).
|
||||
Performs (at most) $(BIGOH range.length) evaluations of $(D pred).
|
||||
+/
|
||||
bool all(Range)(Range range)
|
||||
|
@ -147,7 +147,7 @@ template any(alias pred = "a")
|
|||
{
|
||||
/++
|
||||
Returns $(D true) if and only if $(I _any) value $(D v) found in the
|
||||
input range $(D range) satisfies the predicate $(D pred).
|
||||
input _range $(D range) satisfies the predicate $(D pred).
|
||||
Performs (at most) $(BIGOH range.length) evaluations of $(D pred).
|
||||
+/
|
||||
bool any(Range)(Range range)
|
||||
|
@ -361,9 +361,11 @@ Params:
|
|||
pred = The predicate to use in comparing elements for commonality. Defaults
|
||||
to equality $(D "a == b").
|
||||
|
||||
r1 = A $(XREF2 range, isForwardRange, forward range) of elements.
|
||||
r1 = A $(XREF_PACK_NAMED range,primitives,isForwardRange,forward range) of
|
||||
elements.
|
||||
|
||||
r2 = An $(XREF2 range, isInputRange, input range) of elements.
|
||||
r2 = An $(XREF_PACK_NAMED range,primitives,isInputRange,input range) of
|
||||
elements.
|
||||
|
||||
Returns:
|
||||
A slice of $(D r1) which contains the characters that both ranges start with,
|
||||
|
@ -665,14 +667,18 @@ size_t count(alias pred = "true", R)(R haystack)
|
|||
}
|
||||
|
||||
/++
|
||||
Counts elements in the given $(XREF2 range, isForwardRange, forward range)
|
||||
Counts elements in the given
|
||||
$(XREF_PACK_NAMED range,primitives,isForwardRange,forward range)
|
||||
until the given predicate is true for one of the given $(D needles).
|
||||
|
||||
Params:
|
||||
pred = The predicate for determining when to stop counting.
|
||||
haystack = The $(XREF2 range, isInputRange, input range) to be counted.
|
||||
needles = Either a single element, or a $(XREF2 range, isForwardRange,
|
||||
forward range) of elements, to be evaluated in turn against each
|
||||
haystack = The
|
||||
$(XREF_PACK_NAMED range,primitives,isInputRange,input range) to be
|
||||
counted.
|
||||
needles = Either a single element, or a
|
||||
$(XREF_PACK_NAMED range,primitives,isForwardRange,forward range)
|
||||
of elements, to be evaluated in turn against each
|
||||
element in $(D haystack) under the given predicate.
|
||||
|
||||
Returns: The number of elements which must be popped from the front of
|
||||
|
@ -833,8 +839,9 @@ ptrdiff_t countUntil(alias pred = "a == b", R, N)(R haystack, N needle)
|
|||
|
||||
Params:
|
||||
pred = Predicate to when to stop counting.
|
||||
haystack = An $(XREF2 range, isInputRange, input range) of elements
|
||||
to be counted.
|
||||
haystack = An
|
||||
$(XREF_PACK_NAMED range,primitives,isInputRange,input range) of
|
||||
elements to be counted.
|
||||
Returns: The number of elements which must be popped from $(D haystack)
|
||||
before $(D pred(haystack.front)) is $(D true).
|
||||
+/
|
||||
|
@ -929,7 +936,8 @@ Params:
|
|||
pred = The predicate to use for comparing elements between the range and
|
||||
the needle(s).
|
||||
|
||||
doesThisEnd = The $(XREF2 range, isBidirectionalRange, bidirectional range)
|
||||
doesThisEnd = The
|
||||
$(XREF_PACK_NAMED range,primitives,isBidirectionalRange,bidirectional range)
|
||||
to check.
|
||||
|
||||
withOneOfThese = The needles to check against, which may be single
|
||||
|
@ -1165,7 +1173,8 @@ $(D "a == b").
|
|||
The negated predicate $(D "a != b") can be used to search instead for the first
|
||||
element $(I not) matching the needle.
|
||||
|
||||
haystack = The $(XREF2 range, isInputRange, input range) searched in.
|
||||
haystack = The $(XREF_PACK_NAMED range,primitives,isInputRange,input range)
|
||||
searched in.
|
||||
|
||||
needle = The element searched for.
|
||||
|
||||
|
@ -1456,7 +1465,8 @@ Params:
|
|||
pred = The predicate for determining if a given element is the one being
|
||||
searched for.
|
||||
|
||||
haystack = The $(XREF2 range, isInputRange, input range) to search in.
|
||||
haystack = The $(XREF_PACK_NAMED range,primitives,isInputRange,input range) to
|
||||
search in.
|
||||
|
||||
Returns:
|
||||
|
||||
|
@ -1545,9 +1555,11 @@ Params:
|
|||
pred = The predicate to use for comparing respective elements from the haystack
|
||||
and the needle. Defaults to simple equality $(D "a == b").
|
||||
|
||||
haystack = The $(XREF2 range, isForwardRange, forward range) searched in.
|
||||
haystack = The $(XREF_PACK_NAMED range,primitives,isForwardRange,forward range)
|
||||
searched in.
|
||||
|
||||
needle = The $(XREF2 range, isForwardRange, forward range) searched for.
|
||||
needle = The $(XREF_PACK_NAMED range,primitives,isForwardRange,forward range)
|
||||
searched for.
|
||||
|
||||
Returns:
|
||||
|
||||
|
@ -2174,7 +2186,8 @@ evaluations of $(D pred).
|
|||
|
||||
Params:
|
||||
pred = The predicate to satisfy.
|
||||
r = A $(XREF2 range, isForwardRange, forward range) to search in.
|
||||
r = A $(XREF_PACK_NAMED range,primitives,isForwardRange,forward range) to
|
||||
search in.
|
||||
|
||||
Returns:
|
||||
$(D r) advanced to the first occurrence of two adjacent elements that satisfy
|
||||
|
@ -2249,9 +2262,10 @@ Performs $(BIGOH seq.length * choices.length) evaluations of $(D pred).
|
|||
|
||||
Params:
|
||||
pred = The predicate to use for determining a match.
|
||||
seq = The $(XREF2 range, isInputRange, input range) to search.
|
||||
choices = A $(XREF2 range, isForwardRange, forward range) of possible
|
||||
choices.
|
||||
seq = The $(XREF_PACK_NAMED range,primitives,isInputRange,input range) to
|
||||
search.
|
||||
choices = A $(XREF_PACK_NAMED range,primitives,isForwardRange,forward range)
|
||||
of possible choices.
|
||||
|
||||
Returns:
|
||||
$(D seq) advanced to the first matching element, or until empty if there are no
|
||||
|
@ -2295,8 +2309,12 @@ Range1 findAmong(alias pred = "a == b", Range1, Range2)(
|
|||
* right after the first occurrence of $(D needle).
|
||||
*
|
||||
* Params:
|
||||
* haystack = The $(XREF2 range, isForwardRange, forward range) to search in.
|
||||
* needle = The $(XREF2 range, isForwardRange, forward range) to search for.
|
||||
* haystack = The
|
||||
* $(XREF_PACK_NAMED range,primitives,isForwardRange,forward range) to search
|
||||
* in.
|
||||
* needle = The
|
||||
* $(XREF_PACK_NAMED range,primitives,isForwardRange,forward range) to search
|
||||
* for.
|
||||
*
|
||||
* Returns: $(D true) if the needle was found, in which case $(D haystack) is
|
||||
* positioned after the end of the first occurrence of $(D needle); otherwise
|
||||
|
@ -2841,9 +2859,10 @@ range, or do nothing if there is no match.
|
|||
Params:
|
||||
pred = The predicate that determines whether elements from each respective
|
||||
range match. Defaults to equality $(D "a == b").
|
||||
r1 = The $(XREF2 range, isForwardRange, forward range) to move forward.
|
||||
r2 = The $(XREF2 range, isInputRange, input range) representing the initial
|
||||
segment of $(D r1) to skip over.
|
||||
r1 = The $(XREF_PACK_NAMED range,primitives,isForwardRange,forward range) to
|
||||
move forward.
|
||||
r2 = The $(XREF_PACK_NAMED range,primitives,isInputRange,input range)
|
||||
representing the initial segment of $(D r1) to skip over.
|
||||
|
||||
Returns:
|
||||
true if the initial segment of $(D r1) matches $(D r2), and $(D r1) has been
|
||||
|
@ -2920,7 +2939,8 @@ Params:
|
|||
pred = The predicate that determines whether an element from the range
|
||||
matches the given element.
|
||||
|
||||
r = The $(XREF range, isInputRange, input range) to skip over.
|
||||
r = The $(XREF_PACK_NAMED range,primitives,isInputRange,input range) to skip
|
||||
over.
|
||||
|
||||
e = The element to match.
|
||||
|
||||
|
@ -2967,8 +2987,9 @@ bool skipOver(alias pred, R, E)(ref R r, E e)
|
|||
}
|
||||
|
||||
/**
|
||||
Checks whether the given $(XREF2 range, isInputRange, input range) starts with
|
||||
(one of) the given needle(s).
|
||||
Checks whether the given
|
||||
$(XREF_PACK_NAMED range,primitives,isInputRange,input range) starts with (one
|
||||
of) the given needle(s).
|
||||
|
||||
Params:
|
||||
|
||||
|
@ -3395,17 +3416,19 @@ $(D pred(e, sentinel)) is true.
|
|||
|
||||
Params:
|
||||
pred = Predicate to determine when to stop.
|
||||
range = The $(XREF2 range, isInputRange, input range) to iterate over.
|
||||
range = The $(XREF_PACK_NAMED _range,primitives,isInputRange,input _range)
|
||||
to iterate over.
|
||||
sentinel = The element to stop at.
|
||||
openRight = Determines whether the element for which the given predicate is
|
||||
true should be included in the resulting range ($(D OpenRight.no)), or
|
||||
not ($(D OpenRight.yes)).
|
||||
|
||||
Returns:
|
||||
An $(XREF2 range, isInputRange, input range) that iterates over the
|
||||
original range's elements, but ends when the specified predicate becomes
|
||||
true. If the original range is a $(XREF2 range, isForwardRange, forward
|
||||
range) or higher, this range will be a forward range.
|
||||
An $(XREF_PACK_NAMED _range,primitives,isInputRange,input _range) that
|
||||
iterates over the original range's elements, but ends when the specified
|
||||
predicate becomes true. If the original range is a
|
||||
$(XREF_PACK_NAMED _range,primitives,isForwardRange,forward _range) or
|
||||
higher, this range will be a forward range.
|
||||
*/
|
||||
Until!(pred, Range, Sentinel)
|
||||
until(alias pred = "a == b", Range, Sentinel)
|
||||
|
|
|
@ -944,7 +944,7 @@ time complexity.
|
|||
See_Also:
|
||||
$(XREF range, assumeSorted)$(BR)
|
||||
$(XREF range, SortedRange)$(BR)
|
||||
$(XREF algorithm, SwapStrategy)$(BR)
|
||||
$(XREF_PACK algorithm,mutation,SwapStrategy)$(BR)
|
||||
$(XREF functional, binaryFun)
|
||||
*/
|
||||
SortedRange!(Range, less)
|
||||
|
@ -2281,10 +2281,12 @@ Params:
|
|||
less = A binary predicate that defines the ordering of range elements.
|
||||
Defaults to $(D a < b).
|
||||
ss = $(RED (Not implemented yet.)) Specify the swapping strategy.
|
||||
r = A $(XREF2 range, isRandomAccessRange, random-access range) of elements
|
||||
to make an index for.
|
||||
index = A $(XREF2 range, isRandomAccessRange, random-access range) with
|
||||
assignable elements to build the index in. The length of this range
|
||||
r = A
|
||||
$(XREF_PACK_NAMED range,primitives,isRandomAccessRange,random-access range)
|
||||
of elements to make an index for.
|
||||
index = A
|
||||
$(XREF_PACK_NAMED range,primitives,isRandomAccessRange,random-access range)
|
||||
with assignable elements to build the index in. The length of this range
|
||||
determines how many top elements to index in $(D r).
|
||||
|
||||
This index range can either have integral elements, in which case the
|
||||
|
|
19
std/array.d
19
std/array.d
|
@ -1431,7 +1431,8 @@ delimiter. Runs of whitespace are merged together (no empty words are produced).
|
|||
$(D @safe), $(D pure) and $(D CTFE)-able.
|
||||
|
||||
See_Also:
|
||||
$(XREF algorithm, splitter) for a version that splits using any separator.
|
||||
$(XREF_PACK algorithm,iteration,splitter) for a version that splits using any
|
||||
separator.
|
||||
|
||||
$(XREF regex, splitter) for a version that splits using a regular
|
||||
expression defined separator.
|
||||
|
@ -1523,7 +1524,7 @@ unittest
|
|||
}
|
||||
|
||||
/++
|
||||
Alias for $(XREF algorithm, _splitter).
|
||||
Alias for $(XREF_PACK algorithm,iteration,_splitter).
|
||||
+/
|
||||
deprecated("Please use std.algorithm.iteration.splitter instead.")
|
||||
alias splitter = std.algorithm.iteration.splitter;
|
||||
|
@ -1531,9 +1532,10 @@ alias splitter = std.algorithm.iteration.splitter;
|
|||
/++
|
||||
Eagerly splits $(D range) into an array, using $(D sep) as the delimiter.
|
||||
|
||||
The range must be a $(XREF2 range, isForwardRange, forward range).
|
||||
The separator can be a value of the same type as the elements in $(D range) or
|
||||
it can be another forward range.
|
||||
The _range must be a
|
||||
$(XREF_PACK_NAMED _range,primitives,isForwardRange,forward _range).
|
||||
The separator can be a value of the same type as the elements in $(D range)
|
||||
or it can be another forward _range.
|
||||
|
||||
Examples:
|
||||
If $(D range) is a $(D string), $(D sep) can be a $(D char) or another
|
||||
|
@ -1542,7 +1544,7 @@ alias splitter = std.algorithm.iteration.splitter;
|
|||
The return type will be an array of $(D int) arrays.
|
||||
|
||||
Params:
|
||||
range = a forward range.
|
||||
range = a forward _range.
|
||||
sep = a value of the same type as the elements of $(D range) or another
|
||||
forward range.
|
||||
|
||||
|
@ -1550,7 +1552,8 @@ alias splitter = std.algorithm.iteration.splitter;
|
|||
An array containing the divided parts of $(D range).
|
||||
|
||||
See_Also:
|
||||
$(XREF algorithm, splitter) for the lazy version of this function.
|
||||
$(XREF_PACK algorithm,iteration,splitter) for the lazy version of this
|
||||
function.
|
||||
+/
|
||||
auto split(Range, Separator)(Range range, Separator sep)
|
||||
if (isForwardRange!Range && is(typeof(ElementType!Range.init == Separator.init)))
|
||||
|
@ -1649,7 +1652,7 @@ private enum bool hasCheapIteration(R) = isArray!R;
|
|||
an allocated array of Elements
|
||||
|
||||
See_Also:
|
||||
$(XREF algorithm, joiner)
|
||||
$(XREF_PACK algorithm,iteration,joiner)
|
||||
+/
|
||||
ElementEncodingType!(ElementType!RoR)[] join(RoR, R)(RoR ror, R sep)
|
||||
if(isInputRange!RoR &&
|
||||
|
|
|
@ -6,7 +6,7 @@ This module defines generic containers.
|
|||
Construction:
|
||||
|
||||
To implement the different containers both struct and class based
|
||||
approaches have been used. $(XREF container_util, make) allows for
|
||||
approaches have been used. $(XREF_PACK _container,util,make) allows for
|
||||
uniform construction with either approach.
|
||||
|
||||
---
|
||||
|
@ -84,7 +84,8 @@ array1 = array2;
|
|||
array1.removeBack();
|
||||
assert(array2.empty);
|
||||
---
|
||||
It is therefore recommended to always construct containers using $(XREF container_util, make).
|
||||
It is therefore recommended to always construct containers using
|
||||
$(XREF_PACK _container,util,make).
|
||||
|
||||
This is in fact necessary to put containers into another _container.
|
||||
For example, to construct an $(D Array) of ten empty $(D Array)s, use
|
||||
|
|
36
std/csv.d
36
std/csv.d
|
@ -309,10 +309,11 @@ enum Malformed
|
|||
* -------
|
||||
*
|
||||
* Returns:
|
||||
* An input range R as defined by $(XREF range, isInputRange). When $(D
|
||||
* Contents) is a struct, class, or an associative array, the element
|
||||
* type of R is $(D Contents), otherwise the element type of R is itself
|
||||
* a range with element type $(D Contents).
|
||||
* An input range R as defined by
|
||||
* $(XREF_PACK range,primitives,isInputRange). When $(D Contents) is a
|
||||
* struct, class, or an associative array, the element type of R is
|
||||
* $(D Contents), otherwise the element type of R is itself a range with
|
||||
* element type $(D Contents).
|
||||
*
|
||||
* Throws:
|
||||
* $(LREF CSVException) When a quote is found in an unquoted field,
|
||||
|
@ -383,10 +384,11 @@ auto csvReader(Contents = string,Malformed ErrorLevel = Malformed.throwException
|
|||
* -------
|
||||
*
|
||||
* Returns:
|
||||
* An input range R as defined by $(XREF range, isInputRange). When $(D
|
||||
* Contents) is a struct, class, or an associative array, the element
|
||||
* type of R is $(D Contents), otherwise the element type of R is itself
|
||||
* a range with element type $(D Contents).
|
||||
* An input range R as defined by
|
||||
* $(XREF_PACK range,primitives,isInputRange). When $(D Contents) is a
|
||||
* struct, class, or an associative array, the element type of R is
|
||||
* $(D Contents), otherwise the element type of R is itself a range with
|
||||
* element type $(D Contents).
|
||||
*
|
||||
* The returned range provides a header field for accessing the header
|
||||
* from the input in array form.
|
||||
|
@ -948,7 +950,8 @@ public:
|
|||
}
|
||||
|
||||
/**
|
||||
* Part of an input range as defined by $(XREF range, isInputRange).
|
||||
* Part of an input range as defined by
|
||||
* $(XREF_PACK range,primitives,isInputRange).
|
||||
*
|
||||
* Returns:
|
||||
* If $(D Contents) is a struct, will be filled with record data.
|
||||
|
@ -979,7 +982,8 @@ public:
|
|||
}
|
||||
|
||||
/**
|
||||
* Part of an input range as defined by $(XREF range, isInputRange).
|
||||
* Part of an input range as defined by
|
||||
* $(XREF_PACK range,primitives,isInputRange).
|
||||
*/
|
||||
@property bool empty() @safe @nogc pure nothrow const
|
||||
{
|
||||
|
@ -987,7 +991,8 @@ public:
|
|||
}
|
||||
|
||||
/**
|
||||
* Part of an input range as defined by $(XREF range, isInputRange).
|
||||
* Part of an input range as defined by
|
||||
* $(XREF_PACK range,primitives,isInputRange).
|
||||
*
|
||||
* Throws:
|
||||
* $(LREF CSVException) When a quote is found in an unquoted field,
|
||||
|
@ -1179,7 +1184,8 @@ public:
|
|||
}
|
||||
|
||||
/**
|
||||
* Part of an input range as defined by $(XREF range, isInputRange).
|
||||
* Part of an input range as defined by
|
||||
* $(XREF_PACK range,primitives,isInputRange).
|
||||
*/
|
||||
@property Contents front() @safe pure
|
||||
{
|
||||
|
@ -1188,7 +1194,8 @@ public:
|
|||
}
|
||||
|
||||
/**
|
||||
* Part of an input range as defined by $(XREF range, isInputRange).
|
||||
* Part of an input range as defined by
|
||||
* $(XREF_PACK range,primitives,isInputRange).
|
||||
*/
|
||||
@property bool empty() @safe pure nothrow @nogc const
|
||||
{
|
||||
|
@ -1212,7 +1219,8 @@ public:
|
|||
|
||||
|
||||
/**
|
||||
* Part of an input range as defined by $(XREF range, isInputRange).
|
||||
* Part of an input range as defined by
|
||||
* $(XREF_PACK range,primitives,isInputRange).
|
||||
*
|
||||
* Throws:
|
||||
* $(LREF CSVException) When a quote is found in an unquoted field,
|
||||
|
|
|
@ -25,10 +25,11 @@ $(TR $(TDNW Helpers) $(TD $(MYREF crcHexString) $(MYREF crc32Of))
|
|||
* module.
|
||||
*
|
||||
* Note:
|
||||
* CRCs are usually printed with the MSB first. When using $(XREF digest.digest, toHexString) the result
|
||||
* will be in an unexpected order. Use $(XREF digest.digest, toHexString)s optional order parameter
|
||||
* to specify decreasing order for the correct result. The $(LREF crcHexString) alias can also
|
||||
* be used for this purpose.
|
||||
* CRCs are usually printed with the MSB first. When using
|
||||
* $(XREF_PACK digest,digest,toHexString) the result will be in an unexpected
|
||||
* order. Use $(XREF_PACK digest,digest,toHexString)'s optional order parameter
|
||||
* to specify decreasing order for the correct result. The $(LREF crcHexString)
|
||||
* alias can also be used for this purpose.
|
||||
*
|
||||
* License: $(WEB www.boost.org/LICENSE_1_0.txt, Boost License 1.0).
|
||||
*
|
||||
|
@ -156,8 +157,8 @@ struct CRC32
|
|||
public:
|
||||
/**
|
||||
* Use this to feed the digest with data.
|
||||
* Also implements the $(XREF range, OutputRange) interface for $(D ubyte) and
|
||||
* $(D const(ubyte)[]).
|
||||
* Also implements the $(XREF_PACK range,primitives,isOutputRange)
|
||||
* interface for $(D ubyte) and $(D const(ubyte)[]).
|
||||
*/
|
||||
void put(scope const(ubyte)[] data...) @trusted pure nothrow @nogc
|
||||
{
|
||||
|
@ -306,12 +307,13 @@ unittest
|
|||
}
|
||||
|
||||
/**
|
||||
* This is a convenience alias for $(XREF digest.digest, digest) using the
|
||||
* This is a convenience alias for $(XREF_PACK digest,digest,digest) using the
|
||||
* CRC32 implementation.
|
||||
*
|
||||
* Params:
|
||||
* data = $(D InputRange) of $(D ElementType) implicitly convertible to $(D ubyte), $(D ubyte[]) or $(D ubyte[num])
|
||||
* or one or more arrays of any type.
|
||||
* data = $(D InputRange) of $(D ElementType) implicitly convertible to
|
||||
* $(D ubyte), $(D ubyte[]) or $(D ubyte[num]) or one or more arrays
|
||||
* of any type.
|
||||
*
|
||||
* Returns:
|
||||
* CRC32 of data
|
||||
|
@ -340,8 +342,8 @@ unittest
|
|||
}
|
||||
|
||||
/**
|
||||
* This is a convenience alias for $(XREF digest.digest, toHexString) producing the usual
|
||||
* CRC32 string output.
|
||||
* This is a convenience alias for $(XREF_PACK digest,digest,toHexString)
|
||||
* producing the usual CRC32 string output.
|
||||
*/
|
||||
public alias crcHexString = toHexString!(Order.decreasing);
|
||||
///ditto
|
||||
|
@ -352,8 +354,8 @@ public alias crcHexString = toHexString!(Order.decreasing, 16);
|
|||
* OOP API CRC32 implementation.
|
||||
* See $(D std.digest.digest) for differences between template and OOP API.
|
||||
*
|
||||
* This is an alias for $(XREF digest.digest, WrapperDigest)!CRC32, see
|
||||
* $(XREF digest.digest, WrapperDigest) for more information.
|
||||
* This is an alias for $(D $(XREF_PACK digest,digest,WrapperDigest)!CRC32), see
|
||||
* there for more information.
|
||||
*/
|
||||
alias CRC32Digest = WrapperDigest!CRC32;
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/**
|
||||
* This module describes the digest APIs used in Phobos. All digests follow these APIs.
|
||||
* Additionally, this module contains useful helper methods which can be used with every _digest type.
|
||||
* This module describes the _digest APIs used in Phobos. All digests follow
|
||||
* these APIs. Additionally, this module contains useful helper methods which
|
||||
* can be used with every _digest type.
|
||||
*
|
||||
$(SCRIPT inhibitQuickIndex = 1;)
|
||||
|
||||
|
@ -202,9 +203,10 @@ version(ExampleDigest)
|
|||
public:
|
||||
/**
|
||||
* Use this to feed the digest with data.
|
||||
* Also implements the $(XREF range, OutputRange) interface for $(D ubyte) and
|
||||
* $(D const(ubyte)[]).
|
||||
* The following usages of $(D put) must work for any type which passes $(LREF isDigest):
|
||||
* Also implements the $(XREF_PACK range,primitives,isOutputRange)
|
||||
* interface for $(D ubyte) and $(D const(ubyte)[]).
|
||||
* The following usages of $(D put) must work for any type which
|
||||
* passes $(LREF isDigest):
|
||||
* Examples:
|
||||
* ----
|
||||
* ExampleDigest dig;
|
||||
|
@ -540,8 +542,8 @@ interface Digest
|
|||
public:
|
||||
/**
|
||||
* Use this to feed the digest with data.
|
||||
* Also implements the $(XREF range, OutputRange) interface for $(D ubyte) and
|
||||
* $(D const(ubyte)[]).
|
||||
* Also implements the $(XREF_PACK range,primitives,isOutputRange)
|
||||
* interface for $(D ubyte) and $(D const(ubyte)[]).
|
||||
*
|
||||
* Examples:
|
||||
* ----
|
||||
|
@ -837,8 +839,8 @@ class WrapperDigest(T) if(isDigest!T) : Digest
|
|||
|
||||
/**
|
||||
* Use this to feed the digest with data.
|
||||
* Also implements the $(XREF range, OutputRange) interface for $(D ubyte) and
|
||||
* $(D const(ubyte)[]).
|
||||
* Also implements the $(XREF_PACK range,primitives,isOutputRange)
|
||||
* interface for $(D ubyte) and $(D const(ubyte)[]).
|
||||
*/
|
||||
@trusted nothrow void put(scope const(ubyte)[] data...)
|
||||
{
|
||||
|
|
|
@ -286,8 +286,8 @@ struct MD5
|
|||
public:
|
||||
/**
|
||||
* Use this to feed the digest with data.
|
||||
* Also implements the $(XREF range, OutputRange) interface for $(D ubyte) and
|
||||
* $(D const(ubyte)[]).
|
||||
* Also implements the $(XREF_PACK range,primitives,isOutputRange)
|
||||
* interface for $(D ubyte) and $(D const(ubyte)[]).
|
||||
*
|
||||
* Examples:
|
||||
* ----
|
||||
|
@ -490,7 +490,7 @@ unittest
|
|||
}
|
||||
|
||||
/**
|
||||
* This is a convenience alias for $(XREF digest.digest, digest) using the
|
||||
* This is a convenience alias for $(XREF_PACK digest,digest,digest) using the
|
||||
* MD5 implementation.
|
||||
*/
|
||||
//simple alias doesn't work here, hope this gets inlined...
|
||||
|
@ -510,8 +510,8 @@ unittest
|
|||
* OOP API MD5 implementation.
|
||||
* See $(D std.digest.digest) for differences between template and OOP API.
|
||||
*
|
||||
* This is an alias for $(XREF digest.digest, WrapperDigest)!MD5, see
|
||||
* $(XREF digest.digest, WrapperDigest) for more information.
|
||||
* This is an alias for $(D $(XREF_PACK digest,digest,WrapperDigest)!MD5), see
|
||||
* there for more information.
|
||||
*/
|
||||
alias MD5Digest = WrapperDigest!MD5;
|
||||
|
||||
|
|
|
@ -442,8 +442,8 @@ struct RIPEMD160
|
|||
public:
|
||||
/**
|
||||
* Use this to feed the digest with data.
|
||||
* Also implements the $(XREF range, OutputRange) interface for $(D ubyte) and
|
||||
* $(D const(ubyte)[]).
|
||||
* Also implements the $(XREF_PACK range,primitives,isOutputRange)
|
||||
* interface for $(D ubyte) and $(D const(ubyte)[]).
|
||||
*
|
||||
* Examples:
|
||||
* ----
|
||||
|
@ -659,7 +659,7 @@ unittest
|
|||
}
|
||||
|
||||
/**
|
||||
* This is a convenience alias for $(XREF digest.digest, digest) using the
|
||||
* This is a convenience alias for $(XREF_PACK digest,digest,digest) using the
|
||||
* RIPEMD160 implementation.
|
||||
*/
|
||||
//simple alias doesn't work here, hope this gets inlined...
|
||||
|
@ -679,8 +679,8 @@ unittest
|
|||
* OOP API RIPEMD160 implementation.
|
||||
* See $(D std.digest.digest) for differences between template and OOP API.
|
||||
*
|
||||
* This is an alias for $(XREF digest.digest, WrapperDigest)!RIPEMD160, see
|
||||
* $(XREF digest.digest, WrapperDigest) for more information.
|
||||
* This is an alias for $(D $(XREF_PACK digest,digest,WrapperDigest)!RIPEMD160),
|
||||
* see there for more information.
|
||||
*/
|
||||
alias RIPEMD160Digest = WrapperDigest!RIPEMD160;
|
||||
|
||||
|
|
|
@ -688,8 +688,8 @@ struct SHA(int blockSize, int digestSize)
|
|||
|
||||
/**
|
||||
* Use this to feed the digest with data.
|
||||
* Also implements the $(XREF range, OutputRange) interface for $(D ubyte) and
|
||||
* $(D const(ubyte)[]).
|
||||
* Also implements the $(XREF_PACK range,primitives,isOutputRange)
|
||||
* interface for $(D ubyte) and $(D const(ubyte)[]).
|
||||
*/
|
||||
void put(scope const(ubyte)[] input...) @trusted pure nothrow @nogc
|
||||
{
|
||||
|
@ -1093,7 +1093,7 @@ unittest
|
|||
}
|
||||
|
||||
/**
|
||||
* These are convenience aliases for $(XREF digest.digest, digest) using the
|
||||
* These are convenience aliases for $(XREF_PACK digest,digest,digest) using the
|
||||
* SHA implementation.
|
||||
*/
|
||||
//simple alias doesn't work here, hope this gets inlined...
|
||||
|
@ -1172,8 +1172,8 @@ unittest
|
|||
* OOP API SHA1 and SHA2 implementations.
|
||||
* See $(D std.digest.digest) for differences between template and OOP API.
|
||||
*
|
||||
* This is an alias for $(XREF digest.digest, WrapperDigest)!SHA1, see
|
||||
* $(XREF digest.digest, WrapperDigest) for more information.
|
||||
* This is an alias for $(D $(XREF_PACK digest,digest,WrapperDigest)!SHA1), see
|
||||
* there for more information.
|
||||
*/
|
||||
alias SHA1Digest = WrapperDigest!SHA1;
|
||||
alias SHA224Digest = WrapperDigest!SHA224; ///ditto
|
||||
|
|
|
@ -1664,9 +1664,9 @@ Returns: A wrapper $(D struct) that preserves the range interface of $(D input).
|
|||
opSlice:
|
||||
Infinite ranges with slicing support must return an instance of
|
||||
$(XREF range, Take) when sliced with a specific lower and upper
|
||||
bound (see $(XREF range_primitives, hasSlicing)); $(D handle) deals with this
|
||||
by $(D take)ing 0 from the return value of the handler function and returning
|
||||
that when an exception is caught.
|
||||
bound (see $(XREF_PACK range,primitives,hasSlicing)); $(D handle) deals with
|
||||
this by $(D take)ing 0 from the return value of the handler function and
|
||||
returning that when an exception is caught.
|
||||
*/
|
||||
auto handle(E : Throwable, RangePrimitive primitivesToHandle, alias handler, Range)(Range input)
|
||||
if (isInputRange!Range)
|
||||
|
|
|
@ -107,7 +107,7 @@ private alias enforceFmt = enforceEx!FormatException;
|
|||
Interprets variadic argument list $(D args), formats them according
|
||||
to $(D fmt), and sends the resulting characters to $(D w). The
|
||||
encoding of the output is the same as $(D Char). The type $(D Writer)
|
||||
must satisfy $(XREF range,isOutputRange!(Writer, Char)).
|
||||
must satisfy $(D $(XREF_PACK range,primitives,isOutputRange)!(Writer, Char)).
|
||||
|
||||
The variadic arguments are normally consumed in order. POSIX-style
|
||||
$(WEB opengroup.org/onlinepubs/009695399/functions/printf.html,
|
||||
|
|
|
@ -1563,13 +1563,15 @@ public:
|
|||
Eager parallel map. The eagerness of this function means it has less
|
||||
overhead than the lazily evaluated $(D TaskPool.map) and should be
|
||||
preferred where the memory requirements of eagerness are acceptable.
|
||||
$(D functions) are the functions to be evaluated, passed as template alias
|
||||
parameters in a style similar to $(XREF algorithm, map). The first
|
||||
argument must be a random access range. For performance reasons, amap
|
||||
will assume the range elements have not yet been initialized. Elements will
|
||||
be overwritten without calling a destructor nor doing an assignment. As such,
|
||||
the range must not contain meaningful data: either un-initialized objects, or
|
||||
objects in their $(D .init) state.
|
||||
$(D functions) are the functions to be evaluated, passed as template
|
||||
alias parameters in a style similar to
|
||||
$(XREF_PACK algorithm,iteration,map).
|
||||
The first argument must be a random access range. For performance
|
||||
reasons, amap will assume the range elements have not yet been
|
||||
initialized. Elements will be overwritten without calling a destructor
|
||||
nor doing an assignment. As such, the range must not contain meaningful
|
||||
data: either un-initialized objects, or objects in their $(D .init)
|
||||
state.
|
||||
|
||||
---
|
||||
auto numbers = iota(100_000_000.0);
|
||||
|
@ -2345,15 +2347,16 @@ public:
|
|||
template reduce(functions...)
|
||||
{
|
||||
/**
|
||||
Parallel reduce on a random access range. Except as otherwise noted, usage
|
||||
is similar to $(XREF algorithm, _reduce). This function works by splitting
|
||||
the range to be reduced into work units, which are slices to be reduced in
|
||||
parallel. Once the results from all work units are computed, a final serial
|
||||
reduction is performed on these results to compute the final answer.
|
||||
Therefore, care must be taken to choose the seed value appropriately.
|
||||
Parallel reduce on a random access range. Except as otherwise noted,
|
||||
usage is similar to $(XREF_PACK algorithm,iteration,_reduce). This
|
||||
function works by splitting the range to be reduced into work units,
|
||||
which are slices to be reduced in parallel. Once the results from all
|
||||
work units are computed, a final serial reduction is performed on these
|
||||
results to compute the final answer. Therefore, care must be taken to
|
||||
choose the seed value appropriately.
|
||||
|
||||
Because the reduction is being performed in parallel,
|
||||
$(D functions) must be associative. For notational simplicity, let # be an
|
||||
Because the reduction is being performed in parallel, $(D functions)
|
||||
must be associative. For notational simplicity, let # be an
|
||||
infix operator representing $(D functions). Then, (a # b) # c must equal
|
||||
a # (b # c). Floating point addition is not associative
|
||||
even though addition in exact arithmetic is. Summing floating
|
||||
|
@ -2361,20 +2364,21 @@ public:
|
|||
serially. However, for many practical purposes floating point addition
|
||||
can be treated as associative.
|
||||
|
||||
Note that, since $(D functions) are assumed to be associative, additional
|
||||
optimizations are made to the serial portion of the reduction algorithm.
|
||||
These take advantage of the instruction level parallelism of modern CPUs,
|
||||
in addition to the thread-level parallelism that the rest of this
|
||||
module exploits. This can lead to better than linear speedups relative
|
||||
to $(XREF algorithm, _reduce), especially for fine-grained benchmarks
|
||||
like dot products.
|
||||
Note that, since $(D functions) are assumed to be associative,
|
||||
additional optimizations are made to the serial portion of the reduction
|
||||
algorithm. These take advantage of the instruction level parallelism of
|
||||
modern CPUs, in addition to the thread-level parallelism that the rest
|
||||
of this module exploits. This can lead to better than linear speedups
|
||||
relative to $(XREF_PACK algorithm,iteration,_reduce), especially for
|
||||
fine-grained benchmarks like dot products.
|
||||
|
||||
An explicit seed may be provided as the first argument. If
|
||||
provided, it is used as the seed for all work units and for the final
|
||||
reduction of results from all work units. Therefore, if it is not the
|
||||
identity value for the operation being performed, results may differ from
|
||||
those generated by $(XREF algorithm, _reduce) or depending on how many work
|
||||
units are used. The next argument must be the range to be reduced.
|
||||
identity value for the operation being performed, results may differ
|
||||
from those generated by $(XREF_PACK algorithm,iteration,_reduce) or
|
||||
depending on how many work units are used. The next argument must be
|
||||
the range to be reduced.
|
||||
---
|
||||
// Find the sum of squares of a range in parallel, using
|
||||
// an explicit seed.
|
||||
|
|
|
@ -2781,12 +2781,14 @@ an entire $(D front)/$(D popFront)/$(D empty) structure.
|
|||
$(D fun) maybe be passed either a template alias parameter (existing
|
||||
function, delegate, struct type defining static $(D opCall)... ) or
|
||||
a run-time value argument (delegate, function object... ).
|
||||
The result range models an InputRange ($(XREF range, isInputRange)).
|
||||
The result range models an InputRange
|
||||
($(XREF_PACK range,primitives,isInputRange)).
|
||||
The resulting range will call $(D fun()) on every call to $(D front),
|
||||
and only when $(D front) is called, regardless of how the range is
|
||||
iterated.
|
||||
It is advised to compose generate with either $(XREF algorithm,cache)
|
||||
or $(XREF array,array), or to use it in a foreach loop.
|
||||
It is advised to compose generate with either
|
||||
$(XREF_PACK algorithm,iteration,cache) or $(XREF array,array), or to use it in a
|
||||
foreach loop.
|
||||
A by-value foreach loop means that the loop value is not $(D ref).
|
||||
|
||||
Params:
|
||||
|
@ -7155,10 +7157,10 @@ enum SearchPolicy
|
|||
Represents a sorted range. In addition to the regular range
|
||||
primitives, supports additional operations that take advantage of the
|
||||
ordering, such as merge and binary search. To obtain a $(D
|
||||
SortedRange) from an unsorted range $(D r), use $(XREF algorithm,
|
||||
sort) which sorts $(D r) in place and returns the corresponding $(D
|
||||
SortedRange). To construct a $(D SortedRange) from a range $(D r) that
|
||||
is known to be already sorted, use $(LREF assumeSorted) described
|
||||
SortedRange) from an unsorted range $(D r), use
|
||||
$(XREF_PACK algorithm,sorting,sort) which sorts $(D r) in place and returns the
|
||||
corresponding $(D SortedRange). To construct a $(D SortedRange) from a range
|
||||
$(D r) that is known to be already sorted, use $(LREF assumeSorted) described
|
||||
below.
|
||||
*/
|
||||
struct SortedRange(Range, alias pred = "a < b")
|
||||
|
@ -7787,7 +7789,7 @@ effect on the complexity of subsequent operations specific to sorted
|
|||
ranges (such as binary search). The probability of an arbitrary
|
||||
unsorted range failing the test is very high (however, an
|
||||
almost-sorted range is likely to pass it). To check for sortedness at
|
||||
cost $(BIGOH n), use $(XREF algorithm,isSorted).
|
||||
cost $(BIGOH n), use $(XREF_PACK algorithm,sorting,isSorted).
|
||||
*/
|
||||
auto assumeSorted(alias pred = "a < b", R)(R r)
|
||||
if (isInputRange!(Unqual!R))
|
||||
|
@ -8679,7 +8681,7 @@ struct NullSink
|
|||
in the case of the version of $(D tee) that takes a function, the function
|
||||
will not actually be executed until the range is "walked" using functions
|
||||
that evaluate ranges, such as $(XREF array,array) or
|
||||
$(XREF algorithm,reduce).
|
||||
$(XREF_PACK algorithm,iteration,reduce).
|
||||
|
||||
Params:
|
||||
pipeOnPop = If `Yes.pipeOnPop`, simply iterating the range without ever
|
||||
|
@ -8699,7 +8701,7 @@ struct NullSink
|
|||
iterated and returns its elements in turn. In addition, the same elements
|
||||
will be passed to `outputRange` or `fun` as well.
|
||||
|
||||
See_Also: $(XREF algorithm, each)
|
||||
See_Also: $(XREF_PACK algorithm,iteration,each)
|
||||
+/
|
||||
auto tee(Flag!"pipeOnPop" pipeOnPop = Yes.pipeOnPop, R1, R2)(R1 inputRange, R2 outputRange)
|
||||
if (isInputRange!R1 && isOutputRange!(R2, ElementType!R1))
|
||||
|
|
|
@ -2269,8 +2269,8 @@ void main()
|
|||
}
|
||||
---
|
||||
|
||||
$(XREF algorithm, joiner) can be used to join chunks together into a single
|
||||
range lazily.
|
||||
$(XREF_PACK algorithm,iteration,joiner) can be used to join chunks together into
|
||||
a single range lazily.
|
||||
Example:
|
||||
---
|
||||
import std.algorithm, std.stdio;
|
||||
|
|
|
@ -86,10 +86,10 @@ $(TR $(TH Module) $(TH Functions) )
|
|||
$(LEADINGROW Publicly imported functions)
|
||||
$(TR $(TD std.algorithm)
|
||||
$(TD
|
||||
$(SHORTXREF algorithm, cmp)
|
||||
$(SHORTXREF algorithm, count)
|
||||
$(SHORTXREF algorithm, endsWith)
|
||||
$(SHORTXREF algorithm, startsWith)
|
||||
$(SHORTXREF_PACK algorithm,comparison,cmp)
|
||||
$(SHORTXREF_PACK algorithm,searching,count)
|
||||
$(SHORTXREF_PACK algorithm,searching,endsWith)
|
||||
$(SHORTXREF_PACK algorithm,searching,startsWith)
|
||||
))
|
||||
$(TR $(TD std.array)
|
||||
$(TD
|
||||
|
@ -134,6 +134,7 @@ See_Also:
|
|||
|
||||
Macros: WIKI = Phobos/StdString
|
||||
SHORTXREF=$(XREF2 $1, $2, $(TT $2))
|
||||
SHORTXREF_PACK=$(XREF_PACK_NAMED $2, $(TT $3),$1, $3)
|
||||
|
||||
Copyright: Copyright Digital Mars 2007-.
|
||||
|
||||
|
|
10
std/uni.d
10
std/uni.d
|
@ -7080,7 +7080,7 @@ unittest
|
|||
|
||||
See_Also:
|
||||
$(LREF icmp)
|
||||
$(XREF algorithm, cmp)
|
||||
$(XREF_PACK algorithm,comparison,cmp)
|
||||
+/
|
||||
int sicmp(S1, S2)(S1 str1, S2 str2)
|
||||
if(isForwardRange!S1 && is(Unqual!(ElementType!S1) == dchar)
|
||||
|
@ -8981,9 +8981,11 @@ unittest
|
|||
Certain alphabets like German and Greek have no 1:1
|
||||
upper-lower mapping. Use overload of toUpper which takes full string instead.
|
||||
|
||||
toUpper can be used as an argument to $(XREF algorithm, map) to produce an algorithm that can
|
||||
convert a range of characters to upper case without allocating memory.
|
||||
A string can then be produced by using $(XREF algorithm, copy) to send it to an $(XREF array, appender).
|
||||
toUpper can be used as an argument to $(XREF_PACK algorithm,iteration,map)
|
||||
to produce an algorithm that can convert a range of characters to upper case
|
||||
without allocating memory.
|
||||
A string can then be produced by using $(XREF_PACK algorithm,mutation,copy)
|
||||
to send it to an $(XREF array, appender).
|
||||
+/
|
||||
@safe pure nothrow @nogc
|
||||
dchar toUpper(dchar c)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue