Skip to content

Commit 04f35f6

Browse files
author
Cameron Custer
committed
keep iterator-form unique/remove_if in tests (ranges:: form is not a strict win)
1 parent 72fec27 commit 04f35f6

6 files changed

Lines changed: 8 additions & 10 deletions

File tree

tests/library_checker_aizu_tests/data_structures/bit_ordered_set.test.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ int main() {
1717
compress.push_back(x);
1818
}
1919
ranges::sort(compress);
20-
compress.erase(begin(ranges::unique(compress)),
21-
end(compress));
20+
compress.erase(unique(all(compress)), end(compress));
2221
BIT bit(sz(compress));
2322
auto get_compressed_idx = [&](int val) -> int {
2423
int l = 0, r = sz(compress);

tests/library_checker_aizu_tests/data_structures/kth_smallest_pst.test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ int main() {
1010
rep(i, 0, n) cin >> arr[i];
1111
vi sorted(arr);
1212
ranges::sort(sorted);
13-
sorted.erase(begin(ranges::unique(sorted)), end(sorted));
13+
sorted.erase(unique(all(sorted)), end(sorted));
1414
for (int& val : arr) {
1515
int start = 0, end = sz(sorted);
1616
while (start + 1 < end) {

tests/library_checker_aizu_tests/data_structures/mode_query.test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ int main() {
1010
rep(i, 0, n) cin >> a[i];
1111
vi comp(a);
1212
ranges::sort(comp);
13-
comp.erase(begin(ranges::unique(comp)), end(comp));
13+
comp.erase(unique(all(comp)), end(comp));
1414
for (int& val : a) {
1515
int start = 0, end = sz(comp);
1616
while (start + 1 < end) {

tests/library_checker_aizu_tests/handmade_tests/seg_tree_find.test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ int main() {
5151
else assert(cur_le == prv_ri);
5252
}
5353
ranges::sort(rngs);
54-
assert(empty(ranges::unique(rngs)));
54+
assert(unique(all(rngs)) == end(rngs));
5555
reset();
5656
assert(
5757
pos == rv(rev.find_last(rv(r - 1), rv(l) + 1, f)));
@@ -67,7 +67,7 @@ int main() {
6767
else assert(prv_le == cur_ri);
6868
}
6969
ranges::sort(rngs);
70-
assert(empty(ranges::unique(rngs)));
70+
assert(unique(all(rngs)) == end(rngs));
7171
}
7272
cout << "Hello World\n";
7373
return 0;

tests/library_checker_aizu_tests/strings/sa_sort_pairs.test.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ int main() {
1010
for (int& x : arr) cin >> x;
1111
vi compress(arr);
1212
ranges::sort(compress);
13-
compress.erase(begin(ranges::unique(compress)),
14-
end(compress));
13+
compress.erase(unique(all(compress)), end(compress));
1514
for (int& x : arr) {
1615
int l = -1, r = int(sz(compress));
1716
while (r - l > 1) {

tests/library_checker_aizu_tests/strings/single_matching_bs.test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ int main() {
7070
vi matches_other(begin(lq_both.sa) + sa_le2,
7171
begin(lq_both.sa) + sa_ri2);
7272
matches_other.erase(
73-
begin(ranges::remove_if(matches_other,
74-
[&](int val) { return val >= sz(s) + 1; })),
73+
remove_if(all(matches_other),
74+
[&](int val) { return val >= sz(s) + 1; }),
7575
end(matches_other));
7676
ranges::sort(matches_other);
7777
assert(matches == matches_other);

0 commit comments

Comments
 (0)