mirror of
https://github.com/dlang/phobos.git
synced 2025-04-30 15:10:46 +03:00
Group documentation in std.algorithm.mutation
This commit is contained in:
parent
afa7d586dd
commit
31cf21bb86
1 changed files with 22 additions and 31 deletions
|
@ -541,12 +541,22 @@ $(HTTP sgi.com/tech/stl/copy_backward.html, STL's copy_backward'):
|
||||||
/**
|
/**
|
||||||
Assigns `value` to each element of input _range `range`.
|
Assigns `value` to each element of input _range `range`.
|
||||||
|
|
||||||
|
Alternatively, instead of using a single `value` to fill the `range`,
|
||||||
|
a `filter` $(REF_ALTTEXT forward _range, isForwardRange, std,_range,primitives)
|
||||||
|
can be provided. The length of `filler` and `range` do not need to match, but
|
||||||
|
`filler` must not be empty.
|
||||||
|
|
||||||
Params:
|
Params:
|
||||||
range = An
|
range = An
|
||||||
$(REF_ALTTEXT input _range, isInputRange, std,_range,primitives)
|
$(REF_ALTTEXT input _range, isInputRange, std,_range,primitives)
|
||||||
that exposes references to its elements and has assignable
|
that exposes references to its elements and has assignable
|
||||||
elements
|
elements
|
||||||
value = Assigned to each element of range
|
value = Assigned to each element of range
|
||||||
|
filler = A
|
||||||
|
$(REF_ALTTEXT forward _range, isForwardRange, std,_range,primitives)
|
||||||
|
representing the _fill pattern.
|
||||||
|
|
||||||
|
Throws: If `filler` is empty.
|
||||||
|
|
||||||
See_Also:
|
See_Also:
|
||||||
$(LREF uninitializedFill)
|
$(LREF uninitializedFill)
|
||||||
|
@ -712,18 +722,7 @@ if ((isInputRange!Range && is(typeof(range.front = value)) ||
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/// ditto
|
||||||
Fills `range` with a pattern copied from `filler`. The length of
|
|
||||||
`range` does not have to be a multiple of the length of $(D
|
|
||||||
filler). If `filler` is empty, an exception is thrown.
|
|
||||||
|
|
||||||
Params:
|
|
||||||
range = An $(REF_ALTTEXT input _range, isInputRange, std,_range,primitives)
|
|
||||||
that exposes references to its elements and has assignable elements.
|
|
||||||
filler = The
|
|
||||||
$(REF_ALTTEXT forward _range, isForwardRange, std,_range,primitives)
|
|
||||||
representing the _fill pattern.
|
|
||||||
*/
|
|
||||||
void fill(InputRange, ForwardRange)(InputRange range, ForwardRange filler)
|
void fill(InputRange, ForwardRange)(InputRange range, ForwardRange filler)
|
||||||
if (isInputRange!InputRange
|
if (isInputRange!InputRange
|
||||||
&& (isForwardRange!ForwardRange
|
&& (isForwardRange!ForwardRange
|
||||||
|
@ -2181,14 +2180,19 @@ if (isBidirectionalRange!Range
|
||||||
|
|
||||||
// reverse
|
// reverse
|
||||||
/**
|
/**
|
||||||
Reverses `r` in-place. Performs `r.length / 2` evaluations of $(D
|
Reverses `r` in-place. Performs `r.length / 2` evaluations of `swap`.
|
||||||
swap).
|
UTF sequences consisting of multiple code units are preserved properly.
|
||||||
|
|
||||||
Params:
|
Params:
|
||||||
r = a $(REF_ALTTEXT bidirectional range, isBidirectionalRange, std,range,primitives)
|
r = a $(REF_ALTTEXT bidirectional range, isBidirectionalRange, std,range,primitives)
|
||||||
with swappable elements or a random access range with a length member
|
with either swappable elements, a random access range with a length member,
|
||||||
|
or a narrow string
|
||||||
|
|
||||||
See_Also:
|
Note:
|
||||||
$(HTTP sgi.com/tech/stl/_reverse.html, STL's _reverse), $(REF retro, std,range) for a lazy reversed range view
|
When passing a string with unicode modifiers on characters, such as `\u0301`,
|
||||||
|
this function will not properly keep the position of the modifier. For example,
|
||||||
|
reversing `ba\u0301d` ("bád") will result in d\u0301ab ("d́ab") instead of
|
||||||
|
`da\u0301b` ("dáb").
|
||||||
*/
|
*/
|
||||||
void reverse(Range)(Range r)
|
void reverse(Range)(Range r)
|
||||||
if (isBidirectionalRange!Range && !isRandomAccessRange!Range
|
if (isBidirectionalRange!Range && !isRandomAccessRange!Range
|
||||||
|
@ -2239,20 +2243,7 @@ if (isRandomAccessRange!Range && hasLength!Range)
|
||||||
assert(range == [3, 2, 1]);
|
assert(range == [3, 2, 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
///ditto
|
||||||
Reverses `r` in-place, where `r` is a narrow string (having
|
|
||||||
elements of type `char` or `wchar`). UTF sequences consisting of
|
|
||||||
multiple code units are preserved properly.
|
|
||||||
|
|
||||||
Params:
|
|
||||||
s = a narrow string
|
|
||||||
|
|
||||||
Bugs:
|
|
||||||
When passing a sting with unicode modifiers on characters, such as `\u0301`,
|
|
||||||
this function will not properly keep the position of the modifier. For example,
|
|
||||||
reversing `ba\u0301d` ("bád") will result in d\u0301ab ("d́ab") instead of
|
|
||||||
`da\u0301b` ("dáb").
|
|
||||||
*/
|
|
||||||
void reverse(Char)(Char[] s)
|
void reverse(Char)(Char[] s)
|
||||||
if (isNarrowString!(Char[]) && !is(Char == const) && !is(Char == immutable))
|
if (isNarrowString!(Char[]) && !is(Char == const) && !is(Char == immutable))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue