mirror of
https://github.com/dlang/phobos.git
synced 2025-05-02 16:10:45 +03:00
swapRanges: Remove redundant constraint tests
hasSwappableElements already tests for isInputRange. Also fix hasSwappableElements docs.
This commit is contained in:
parent
1951dec16b
commit
759da8eec0
2 changed files with 3 additions and 4 deletions
|
@ -2728,9 +2728,8 @@ Returns:
|
||||||
*/
|
*/
|
||||||
Tuple!(InputRange1, InputRange2)
|
Tuple!(InputRange1, InputRange2)
|
||||||
swapRanges(InputRange1, InputRange2)(InputRange1 r1, InputRange2 r2)
|
swapRanges(InputRange1, InputRange2)(InputRange1 r1, InputRange2 r2)
|
||||||
if (isInputRange!(InputRange1) && isInputRange!(InputRange2)
|
if (hasSwappableElements!InputRange1 && hasSwappableElements!InputRange2
|
||||||
&& hasSwappableElements!(InputRange1) && hasSwappableElements!(InputRange2)
|
&& is(ElementType!InputRange1 == ElementType!InputRange2))
|
||||||
&& is(ElementType!(InputRange1) == ElementType!(InputRange2)))
|
|
||||||
{
|
{
|
||||||
for (; !r1.empty && !r2.empty; r1.popFront(), r2.popFront())
|
for (; !r1.empty && !r2.empty; r1.popFront(), r2.popFront())
|
||||||
{
|
{
|
||||||
|
|
|
@ -1261,7 +1261,7 @@ R r;
|
||||||
static assert(isInputRange!R);
|
static assert(isInputRange!R);
|
||||||
swap(r.front, r.front);
|
swap(r.front, r.front);
|
||||||
static if (isBidirectionalRange!R) swap(r.back, r.front);
|
static if (isBidirectionalRange!R) swap(r.back, r.front);
|
||||||
static if (isRandomAccessRange!R) swap(r[], r.front);
|
static if (isRandomAccessRange!R) swap(r[0], r.front);
|
||||||
----
|
----
|
||||||
*/
|
*/
|
||||||
template hasSwappableElements(R)
|
template hasSwappableElements(R)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue