Skip to content

Commit 99b74fb

Browse files
committed
Add @nogc annotated unittest for std.algorithm.remove
1 parent 07d4c37 commit 99b74fb

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

std/algorithm/mutation.d

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1944,6 +1944,18 @@ if (isBidirectionalRange!Range
19441944
[ 1, 3, 3, 4, 5, 5, 6 ]);
19451945
}
19461946

1947+
@nogc unittest
1948+
{
1949+
// @nogc test
1950+
int[10] arr = [0,1,2,3,4,5,6,7,8,9];
1951+
alias pred = e => e < 5;
1952+
1953+
auto r = arr[].remove!(SwapStrategy.unstable)(0);
1954+
r = r.remove!(SwapStrategy.stable)(0);
1955+
r = r.remove!(pred, SwapStrategy.unstable);
1956+
r = r.remove!(pred, SwapStrategy.stable);
1957+
}
1958+
19471959
@safe unittest
19481960
{
19491961
import std.algorithm.comparison : min;

0 commit comments

Comments
 (0)