Skip to content

Commit

Permalink
[libc++] [test] Update "test_compare.h" users to avoid removed-in-C++…
Browse files Browse the repository at this point in the history
…20 members. NFCI.

Drive-by minor improvements to a couple of uses of min_pointer.

Differential Revision: https://reviews.llvm.org/D103366
  • Loading branch information
Arthur O'Dwyer committed May 29, 2021
1 parent 6583142 commit 5cc55fd
Show file tree
Hide file tree
Showing 159 changed files with 912 additions and 951 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@
int main(int, char**)
{
{
typedef test_compare<std::less<int> > C;
typedef test_less<int> C;
const std::map<int, double, C> m(C(3));
assert(m.empty());
assert(m.begin() == m.end());
assert(m.key_comp() == C(3));
}
#if TEST_STD_VER >= 11
{
typedef test_compare<std::less<int> > C;
typedef test_less<int> C;
const std::map<int, double, C, min_allocator<std::pair<const int, double>>> m(C(3));
assert(m.empty());
assert(m.begin() == m.end());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
int main(int, char**)
{
{
typedef test_compare<std::less<int> > C;
typedef test_less<int> C;
typedef test_allocator<std::pair<const int, double> > A;
std::map<int, double, C, A> m(C(4), A(5));
assert(m.empty());
Expand All @@ -33,7 +33,7 @@ int main(int, char**)
}
#if TEST_STD_VER >= 11
{
typedef test_compare<std::less<int> > C;
typedef test_less<int> C;
typedef min_allocator<std::pair<const int, double> > A;
std::map<int, double, C, A> m(C(4), A());
assert(m.empty());
Expand All @@ -42,7 +42,7 @@ int main(int, char**)
assert(m.get_allocator() == A());
}
{
typedef test_compare<std::less<int> > C;
typedef test_less<int> C;
typedef explicit_allocator<std::pair<const int, double> > A;
std::map<int, double, C, A> m(C(4), A{});
assert(m.empty());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ int main(int, char**)
V(3, 1.5),
V(3, 2),
};
typedef test_compare<std::less<int> > C;
typedef test_less<int> C;
typedef test_allocator<V> A;
std::map<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(7));
std::map<int, double, C, A> m = mo;
Expand Down Expand Up @@ -71,7 +71,7 @@ int main(int, char**)
V(3, 1.5),
V(3, 2),
};
typedef test_compare<std::less<int> > C;
typedef test_less<int> C;
typedef other_allocator<V> A;
std::map<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(7));
std::map<int, double, C, A> m = mo;
Expand Down Expand Up @@ -105,7 +105,7 @@ int main(int, char**)
V(3, 1.5),
V(3, 2),
};
typedef test_compare<std::less<int> > C;
typedef test_less<int> C;
typedef min_allocator<V> A;
std::map<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A());
std::map<int, double, C, A> m = mo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ int main(int, char**)
V(3, 1.5),
V(3, 2),
};
typedef test_compare<std::less<int> > C;
typedef test_less<int> C;
typedef test_allocator<V> A;
std::map<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(7));
std::map<int, double, C, A> m(mo, A(3));
Expand Down Expand Up @@ -71,7 +71,7 @@ int main(int, char**)
V(3, 1.5),
V(3, 2),
};
typedef test_compare<std::less<int> > C;
typedef test_less<int> C;
typedef min_allocator<V> A;
std::map<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A());
std::map<int, double, C, A> m(mo, A());
Expand Down Expand Up @@ -105,7 +105,7 @@ int main(int, char**)
V(3, 1.5),
V(3, 2),
};
typedef test_compare<std::less<int> > C;
typedef test_less<int> C;
typedef explicit_allocator<V> A;
std::map<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A{});
std::map<int, double, C, A> m(mo, A{});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ int main(int, char**)
V(3, 1.5),
V(3, 2)
};
typedef test_compare<std::less<int> > C;
typedef test_less<int> C;
typedef test_allocator<V> A;
std::map<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(2));
std::map<int, double, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0])/2, C(3), A(7));
Expand Down Expand Up @@ -180,7 +180,7 @@ int main(int, char**)
V(3, 1.5),
V(3, 2)
};
typedef test_compare<std::less<int> > C;
typedef test_less<int> C;
typedef other_allocator<V> A;
std::map<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(2));
std::map<int, double, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0])/2, C(3), A(7));
Expand Down Expand Up @@ -216,7 +216,7 @@ int main(int, char**)
V(3, 1.5),
V(3, 2)
};
typedef test_compare<std::less<int> > C;
typedef test_less<int> C;
typedef min_allocator<V> A;
std::map<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A());
std::map<int, double, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0])/2, C(3), A());
Expand Down Expand Up @@ -251,7 +251,7 @@ int main(int, char**)
V(3, 1.5),
V(3, 2)
};
typedef test_compare<std::less<int> > C;
typedef test_less<int> C;
typedef min_allocator<V> A;
std::map<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A());
std::map<int, double, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0])/2, C(3), A());
Expand Down Expand Up @@ -288,7 +288,7 @@ int main(int, char**)
V(3, 1.5),
V(3, 2)
};
typedef test_compare<std::less<int> > C;
typedef test_less<int> C;
typedef counting_allocatorT<V> A;
std::map<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(1));
std::map<int, double, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0])/2, C(3), A(2));
Expand Down Expand Up @@ -322,7 +322,7 @@ int main(int, char**)
V(3, 1.5),
V(3, 2)
};
typedef test_compare<std::less<int> > C;
typedef test_less<int> C;
typedef counting_allocatorF<V> A;
std::map<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(100));
std::map<int, double, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0])/2, C(3), A(200));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ int main(int, char**)
{
{
typedef std::pair<const int, double> V;
typedef test_compare<std::less<int> > C;
typedef test_less<int> C;
std::map<int, double, C> m({
{1, 1},
{1, 1.5},
Expand All @@ -45,7 +45,7 @@ int main(int, char**)
}
{
typedef std::pair<const int, double> V;
typedef test_compare<std::less<int> > C;
typedef test_less<int> C;
std::map<int, double, C, min_allocator<std::pair<const int, double>>> m({
{1, 1},
{1, 1.5},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ int main(int, char**)
{
{
typedef std::pair<const int, double> V;
typedef test_compare<std::less<int> > C;
typedef test_less<int> C;
typedef test_allocator<std::pair<const int, double> > A;
std::map<int, double, C, A> m({
{1, 1},
Expand All @@ -48,7 +48,7 @@ int main(int, char**)
}
{
typedef std::pair<const int, double> V;
typedef test_compare<std::less<int> > C;
typedef test_less<int> C;
typedef min_allocator<std::pair<const int, double> > A;
std::map<int, double, C, A> m({
{1, 1},
Expand All @@ -72,7 +72,7 @@ int main(int, char**)
{
typedef std::pair<const int, double> V;
typedef min_allocator<V> A;
typedef test_compare<std::less<int> > C;
typedef test_less<int> C;
typedef std::map<int, double, C, A> M;
A a;
M m ({ {1, 1},
Expand All @@ -96,7 +96,7 @@ int main(int, char**)
{
typedef std::pair<const int, double> V;
typedef explicit_allocator<V> A;
typedef test_compare<std::less<int> > C;
typedef test_less<int> C;
A a;
std::map<int, double, C, A> m({
{1, 1},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ int main(int, char**)
V(3, 1.5),
V(3, 2),
};
typedef test_compare<std::less<int> > C;
typedef test_less<int> C;
std::map<int, double, C> m(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5));
assert(m.key_comp() == C(5));
assert(m.size() == 3);
Expand All @@ -60,7 +60,7 @@ int main(int, char**)
V(3, 1.5),
V(3, 2),
};
typedef test_compare<std::less<int> > C;
typedef test_less<int> C;
std::map<int, double, C, min_allocator<std::pair<const int, double>>> m(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5));
assert(m.key_comp() == C(5));
assert(m.size() == 3);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ int main(int, char**)
V(3, 1.5),
V(3, 2),
};
typedef test_compare<std::less<int> > C;
typedef test_less<int> C;
typedef test_allocator<V> A;
std::map<int, double, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(7));
assert(m.get_allocator() == A(7));
Expand All @@ -64,7 +64,7 @@ int main(int, char**)
V(3, 1.5),
V(3, 2),
};
typedef test_compare<std::less<int> > C;
typedef test_less<int> C;
typedef min_allocator<V> A;
std::map<int, double, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A());
assert(m.get_allocator() == A());
Expand Down Expand Up @@ -92,7 +92,7 @@ int main(int, char**)
};
{
typedef min_allocator<V> A;
typedef test_compare<std::less<int> > C;
typedef test_less<int> C;
A a;
std::map<int, double, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0]), a );

Expand All @@ -105,7 +105,7 @@ int main(int, char**)
}
{
typedef explicit_allocator<V> A;
typedef test_compare<std::less<int> > C;
typedef test_less<int> C;
A a;
std::map<int, double, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0]), a );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ int main(int, char**)
{
typedef std::pair<const int, double> V;
{
typedef test_compare<std::less<int> > C;
typedef test_less<int> C;
typedef test_allocator<V> A;
std::map<int, double, C, A> mo(C(5), A(7));
std::map<int, double, C, A> m = std::move(mo);
Expand All @@ -53,7 +53,7 @@ int main(int, char**)
V(3, 1.5),
V(3, 2),
};
typedef test_compare<std::less<int> > C;
typedef test_less<int> C;
typedef test_allocator<V> A;
std::map<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A(7));
std::map<int, double, C, A> m = std::move(mo);
Expand All @@ -71,7 +71,7 @@ int main(int, char**)
assert(distance(mo.begin(), mo.end()) == 0);
}
{
typedef test_compare<std::less<int> > C;
typedef test_less<int> C;
typedef min_allocator<V> A;
std::map<int, double, C, A> mo(C(5), A());
std::map<int, double, C, A> m = std::move(mo);
Expand All @@ -98,7 +98,7 @@ int main(int, char**)
V(3, 1.5),
V(3, 2),
};
typedef test_compare<std::less<int> > C;
typedef test_less<int> C;
typedef min_allocator<V> A;
std::map<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A());
std::map<int, double, C, A> m = std::move(mo);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ int main(int, char**)
{
typedef std::pair<MoveOnly, MoveOnly> V;
typedef std::pair<const MoveOnly, MoveOnly> VC;
typedef test_compare<std::less<MoveOnly> > C;
typedef test_less<MoveOnly> C;
typedef test_allocator<VC> A;
typedef std::map<MoveOnly, MoveOnly, C, A> M;
typedef std::move_iterator<V*> I;
Expand Down Expand Up @@ -68,7 +68,7 @@ int main(int, char**)
{
typedef std::pair<MoveOnly, MoveOnly> V;
typedef std::pair<const MoveOnly, MoveOnly> VC;
typedef test_compare<std::less<MoveOnly> > C;
typedef test_less<MoveOnly> C;
typedef test_allocator<VC> A;
typedef std::map<MoveOnly, MoveOnly, C, A> M;
typedef std::move_iterator<V*> I;
Expand Down Expand Up @@ -107,7 +107,7 @@ int main(int, char**)
{
typedef std::pair<MoveOnly, MoveOnly> V;
typedef std::pair<const MoveOnly, MoveOnly> VC;
typedef test_compare<std::less<MoveOnly> > C;
typedef test_less<MoveOnly> C;
typedef other_allocator<VC> A;
typedef std::map<MoveOnly, MoveOnly, C, A> M;
typedef std::move_iterator<V*> I;
Expand Down Expand Up @@ -196,7 +196,7 @@ int main(int, char**)
{
typedef std::pair<MoveOnly, MoveOnly> V;
typedef std::pair<const MoveOnly, MoveOnly> VC;
typedef test_compare<std::less<MoveOnly> > C;
typedef test_less<MoveOnly> C;
typedef min_allocator<VC> A;
typedef std::map<MoveOnly, MoveOnly, C, A> M;
typedef std::move_iterator<V*> I;
Expand Down Expand Up @@ -235,7 +235,7 @@ int main(int, char**)
{
typedef std::pair<MoveOnly, MoveOnly> V;
typedef std::pair<const MoveOnly, MoveOnly> VC;
typedef test_compare<std::less<MoveOnly> > C;
typedef test_less<MoveOnly> C;
typedef explicit_allocator<VC> A;
typedef std::map<MoveOnly, MoveOnly, C, A> M;
typedef std::move_iterator<V*> I;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ int main(int, char**)
{
typedef std::pair<MoveOnly, MoveOnly> V;
typedef std::pair<const MoveOnly, MoveOnly> VC;
typedef test_compare<std::less<MoveOnly> > C;
typedef test_less<MoveOnly> C;
typedef test_allocator<VC> A;
typedef std::map<MoveOnly, MoveOnly, C, A> M;
typedef std::move_iterator<V*> I;
Expand Down Expand Up @@ -68,7 +68,7 @@ int main(int, char**)
{
typedef std::pair<MoveOnly, MoveOnly> V;
typedef std::pair<const MoveOnly, MoveOnly> VC;
typedef test_compare<std::less<MoveOnly> > C;
typedef test_less<MoveOnly> C;
typedef test_allocator<VC> A;
typedef std::map<MoveOnly, MoveOnly, C, A> M;
typedef std::move_iterator<V*> I;
Expand Down Expand Up @@ -108,7 +108,7 @@ int main(int, char**)
{
typedef std::pair<MoveOnly, MoveOnly> V;
typedef std::pair<const MoveOnly, MoveOnly> VC;
typedef test_compare<std::less<MoveOnly> > C;
typedef test_less<MoveOnly> C;
typedef other_allocator<VC> A;
typedef std::map<MoveOnly, MoveOnly, C, A> M;
typedef std::move_iterator<V*> I;
Expand Down Expand Up @@ -148,7 +148,7 @@ int main(int, char**)
{
typedef std::pair<MoveOnly, MoveOnly> V;
typedef std::pair<const MoveOnly, MoveOnly> VC;
typedef test_compare<std::less<MoveOnly> > C;
typedef test_less<MoveOnly> C;
typedef min_allocator<VC> A;
typedef std::map<MoveOnly, MoveOnly, C, A> M;
typedef std::move_iterator<V*> I;
Expand Down
Loading

0 comments on commit 5cc55fd

Please sign in to comment.