Skip to content

Commit 2ff0a05

Browse files
authored
Merge pull request #6090 from wilzbach/algo-doc-grouping
Group documentation in std.algorithm merged-on-behalf-of: Jack Stouffer <[email protected]>
2 parents 1adf633 + ba7af41 commit 2ff0a05

File tree

2 files changed

+92
-140
lines changed

2 files changed

+92
-140
lines changed

std/algorithm/mutation.d

+22-31
Original file line numberDiff line numberDiff line change
@@ -538,12 +538,22 @@ $(HTTP sgi.com/tech/stl/copy_backward.html, STL's copy_backward'):
538538
/**
539539
Assigns `value` to each element of input _range `range`.
540540
541+
Alternatively, instead of using a single `value` to fill the `range`,
542+
a `filter` $(REF_ALTTEXT forward _range, isForwardRange, std,_range,primitives)
543+
can be provided. The length of `filler` and `range` do not need to match, but
544+
`filler` must not be empty.
545+
541546
Params:
542547
range = An
543548
$(REF_ALTTEXT input _range, isInputRange, std,_range,primitives)
544549
that exposes references to its elements and has assignable
545550
elements
546551
value = Assigned to each element of range
552+
filler = A
553+
$(REF_ALTTEXT forward _range, isForwardRange, std,_range,primitives)
554+
representing the _fill pattern.
555+
556+
Throws: If `filler` is empty.
547557
548558
See_Also:
549559
$(LREF uninitializedFill)
@@ -709,18 +719,7 @@ if ((isInputRange!Range && is(typeof(range.front = value)) ||
709719
}
710720
}
711721

712-
/**
713-
Fills `range` with a pattern copied from `filler`. The length of
714-
`range` does not have to be a multiple of the length of $(D
715-
filler). If `filler` is empty, an exception is thrown.
716-
717-
Params:
718-
range = An $(REF_ALTTEXT input _range, isInputRange, std,_range,primitives)
719-
that exposes references to its elements and has assignable elements.
720-
filler = The
721-
$(REF_ALTTEXT forward _range, isForwardRange, std,_range,primitives)
722-
representing the _fill pattern.
723-
*/
722+
/// ditto
724723
void fill(InputRange, ForwardRange)(InputRange range, ForwardRange filler)
725724
if (isInputRange!InputRange
726725
&& (isForwardRange!ForwardRange
@@ -2178,14 +2177,19 @@ if (isBidirectionalRange!Range
21782177

21792178
// reverse
21802179
/**
2181-
Reverses `r` in-place. Performs `r.length / 2` evaluations of $(D
2182-
swap).
2180+
Reverses `r` in-place. Performs `r.length / 2` evaluations of `swap`.
2181+
UTF sequences consisting of multiple code units are preserved properly.
2182+
21832183
Params:
21842184
r = a $(REF_ALTTEXT bidirectional range, isBidirectionalRange, std,range,primitives)
2185-
with swappable elements or a random access range with a length member
2185+
with either swappable elements, a random access range with a length member,
2186+
or a narrow string
21862187
2187-
See_Also:
2188-
$(HTTP sgi.com/tech/stl/_reverse.html, STL's _reverse), $(REF retro, std,range) for a lazy reversed range view
2188+
Note:
2189+
When passing a string with unicode modifiers on characters, such as `\u0301`,
2190+
this function will not properly keep the position of the modifier. For example,
2191+
reversing `ba\u0301d` ("bád") will result in d\u0301ab ("d́ab") instead of
2192+
`da\u0301b` ("dáb").
21892193
*/
21902194
void reverse(Range)(Range r)
21912195
if (isBidirectionalRange!Range && !isRandomAccessRange!Range
@@ -2236,20 +2240,7 @@ if (isRandomAccessRange!Range && hasLength!Range)
22362240
assert(range == [3, 2, 1]);
22372241
}
22382242

2239-
/**
2240-
Reverses `r` in-place, where `r` is a narrow string (having
2241-
elements of type `char` or `wchar`). UTF sequences consisting of
2242-
multiple code units are preserved properly.
2243-
2244-
Params:
2245-
s = a narrow string
2246-
2247-
Bugs:
2248-
When passing a sting with unicode modifiers on characters, such as `\u0301`,
2249-
this function will not properly keep the position of the modifier. For example,
2250-
reversing `ba\u0301d` ("bád") will result in d\u0301ab ("d́ab") instead of
2251-
`da\u0301b` ("dáb").
2252-
*/
2243+
///ditto
22532244
void reverse(Char)(Char[] s)
22542245
if (isNarrowString!(Char[]) && !is(Char == const) && !is(Char == immutable))
22552246
{

0 commit comments

Comments
 (0)