mirror of
https://github.com/dlang/phobos.git
synced 2025-04-29 14:40:30 +03:00
Automatically set the range style from a..b -> a .. b
Commands: sed -E "s/([[:alnum:]])[.][.]([[:alnum:]])/\1 .. \2/g" -i **/*.d sed -E "s/([[:alnum:]])[.][.] ([[:alnum:]])/\1 .. \2/g" -i **/*.d sed -E "s/([[:alnum:]]) [.][.]([[:alnum:]])/\1 .. \2/g" -i **/*.d
This commit is contained in:
parent
4b49413b5a
commit
425ab667a3
69 changed files with 637 additions and 637 deletions
|
@ -271,7 +271,7 @@ auto castSwitch(choices...)(Object switchObject)
|
|||
|
||||
// Check for overshadowing:
|
||||
immutable indexOfOvershadowingChoice =
|
||||
indexOfFirstOvershadowingChoiceOnLast!(choices[0..index + 1]);
|
||||
indexOfFirstOvershadowingChoiceOnLast!(choices[0 .. index + 1]);
|
||||
static assert(indexOfOvershadowingChoice == index,
|
||||
"choice number %d(type %s) is overshadowed by choice number %d(type %s)".format(
|
||||
index + 1, CastClass.stringof, indexOfOvershadowingChoice + 1,
|
||||
|
@ -335,7 +335,7 @@ auto castSwitch(choices...)(Object switchObject)
|
|||
static if (Parameters!(choice).length == 0)
|
||||
{
|
||||
immutable indexOfOvershadowingChoice =
|
||||
indexOfFirstOvershadowingChoiceOnLast!(choices[0..index + 1]);
|
||||
indexOfFirstOvershadowingChoiceOnLast!(choices[0 .. index + 1]);
|
||||
|
||||
// Check for overshadowing:
|
||||
static assert(indexOfOvershadowingChoice == index,
|
||||
|
|
|
@ -730,7 +730,7 @@ private struct MapResult(alias fun, Range)
|
|||
assert(squares[3] == 16);
|
||||
|
||||
// Test slicing.
|
||||
auto squareSlice = squares[1..squares.length - 1];
|
||||
auto squareSlice = squares[1 .. squares.length - 1];
|
||||
assert(equal(squareSlice, [4, 9][]));
|
||||
assert(squareSlice.back == 9);
|
||||
assert(squareSlice[1] == 9);
|
||||
|
@ -770,9 +770,9 @@ private struct MapResult(alias fun, Range)
|
|||
static assert(!is(ms1[0])); //narrow strings can't be indexed
|
||||
assert(ms2[0] == '日');
|
||||
assert(ms3[0] == 'H');
|
||||
static assert(!is(ms1[0..1])); //narrow strings can't be sliced
|
||||
assert(equal(ms2[0..2], "日本"w));
|
||||
assert(equal(ms3[0..2], "HE"));
|
||||
static assert(!is(ms1[0 .. 1])); //narrow strings can't be sliced
|
||||
assert(equal(ms2[0 .. 2], "日本"w));
|
||||
assert(equal(ms3[0 .. 2], "HE"));
|
||||
|
||||
// Issue 5753
|
||||
static void voidFun(int) {}
|
||||
|
@ -2985,7 +2985,7 @@ The number of seeds must be correspondingly increased.
|
|||
int res;
|
||||
if (actEmpty) return res;
|
||||
|
||||
foreach (i; 0..100)
|
||||
foreach (i; 0 .. 100)
|
||||
{
|
||||
res = dg(i);
|
||||
if (res) break;
|
||||
|
@ -3002,7 +3002,7 @@ The number of seeds must be correspondingly increased.
|
|||
assert(reduce!("a + b", max)(tuple(5, 0), oa) == tuple(hundredSum + 5, 99));
|
||||
|
||||
// Test for throwing on empty range plus no seed.
|
||||
assertThrown(reduce!"a + b"([1, 2][0..0]));
|
||||
assertThrown(reduce!"a + b"([1, 2][0 .. 0]));
|
||||
|
||||
oa.actEmpty = true;
|
||||
assertThrown(reduce!"a + b"(oa));
|
||||
|
|
|
@ -496,8 +496,8 @@ $(HTTP sgi.com/tech/stl/copy_backward.html, STL's copy_backward'):
|
|||
|
||||
{
|
||||
int[] a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
||||
copy(a[5..10], a[4..9]);
|
||||
assert(a[4..9] == [6, 7, 8, 9, 10]);
|
||||
copy(a[5 .. 10], a[4 .. 9]);
|
||||
assert(a[4 .. 9] == [6, 7, 8, 9, 10]);
|
||||
}
|
||||
|
||||
{ // Test for bug 7898
|
||||
|
@ -2024,23 +2024,23 @@ if (isBidirectionalRange!Range
|
|||
import std.typecons : Tuple;
|
||||
alias S = Tuple!(int[2]);
|
||||
S[] soffsets;
|
||||
foreach (start; 0..5)
|
||||
foreach (start; 0 .. 5)
|
||||
foreach (end; min(start+1,5) .. 5)
|
||||
soffsets ~= S([start,end]);
|
||||
alias D = Tuple!(int[2],int[2]);
|
||||
D[] doffsets;
|
||||
foreach (start1; 0..10)
|
||||
foreach (start1; 0 .. 10)
|
||||
foreach (end1; min(start1+1,10) .. 10)
|
||||
foreach (start2; end1 ..10)
|
||||
foreach (start2; end1 .. 10)
|
||||
foreach (end2; min(start2+1,10) .. 10)
|
||||
doffsets ~= D([start1,end1],[start2,end2]);
|
||||
alias T = Tuple!(int[2],int[2],int[2]);
|
||||
T[] toffsets;
|
||||
foreach (start1; 0..15)
|
||||
foreach (start1; 0 .. 15)
|
||||
foreach (end1; min(start1+1,15) .. 15)
|
||||
foreach (start2; end1..15)
|
||||
foreach (start2; end1 .. 15)
|
||||
foreach (end2; min(start2+1,15) .. 15)
|
||||
foreach (start3; end2..15)
|
||||
foreach (start3; end2 .. 15)
|
||||
foreach (end3; min(start3+1,15) .. 15)
|
||||
toffsets ~= T([start1,end1],[start2,end2],[start3,end3]);
|
||||
|
||||
|
|
|
@ -2007,7 +2007,7 @@ unittest
|
|||
size_t[] arr;
|
||||
arr.length = 1024;
|
||||
|
||||
foreach (k; 0..arr.length) arr[k] = k;
|
||||
foreach (k; 0 .. arr.length) arr[k] = k;
|
||||
swapRanges(arr[0..$/2], arr[$/2..$]);
|
||||
|
||||
sort!(pred, SwapStrategy.unstable)(arr);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue