[libcxx] r289358 - Fix undefined behavior in container swap tests.
Eric Fiselier via cfe-commits
cfe-commits at lists.llvm.org
Sat Dec 10 19:41:13 PST 2016
Author: ericwf
Date: Sat Dec 10 21:41:12 2016
New Revision: 289358
URL: http://llvm.org/viewvc/llvm-project?rev=289358&view=rev
Log:
Fix undefined behavior in container swap tests.
These swap tests were swapping non-POCS non-equal allocators which
is undefined behavior. This patch changes the tests to use allocators
which compare equal. In order to test that the allocators were not
swapped I added an "id" field to test_allocator which does not
participate in equality but does propagate across copies/swaps.
This patch is based off of D26623 which was submitted by STL.
Modified:
libcxx/trunk/test/std/containers/associative/map/map.special/non_member_swap.pass.cpp
libcxx/trunk/test/std/containers/associative/multimap/multimap.special/non_member_swap.pass.cpp
libcxx/trunk/test/std/containers/associative/multiset/multiset.special/non_member_swap.pass.cpp
libcxx/trunk/test/std/containers/associative/set/set.special/non_member_swap.pass.cpp
libcxx/trunk/test/std/containers/sequences/deque/deque.special/swap.pass.cpp
libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.spec/member_swap.pass.cpp
libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.spec/non_member_swap.pass.cpp
libcxx/trunk/test/std/containers/sequences/vector.bool/swap.pass.cpp
libcxx/trunk/test/std/containers/sequences/vector/vector.special/swap.pass.cpp
libcxx/trunk/test/std/containers/unord/unord.map/swap_member.pass.cpp
libcxx/trunk/test/std/containers/unord/unord.map/unord.map.swap/swap_non_member.pass.cpp
libcxx/trunk/test/std/containers/unord/unord.multimap/swap_member.pass.cpp
libcxx/trunk/test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_non_member.pass.cpp
libcxx/trunk/test/std/containers/unord/unord.multiset/swap_member.pass.cpp
libcxx/trunk/test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_non_member.pass.cpp
libcxx/trunk/test/std/containers/unord/unord.set/swap_member.pass.cpp
libcxx/trunk/test/std/containers/unord/unord.set/unord.set.swap/swap_non_member.pass.cpp
libcxx/trunk/test/support/test_allocator.h
Modified: libcxx/trunk/test/std/containers/associative/map/map.special/non_member_swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/map.special/non_member_swap.pass.cpp?rev=289358&r1=289357&r2=289358&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/associative/map/map.special/non_member_swap.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/associative/map/map.special/non_member_swap.pass.cpp Sat Dec 10 21:41:12 2016
@@ -121,17 +121,17 @@ int main()
V(11, 11),
V(12, 12)
};
- M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]), C(1), A(1));
- M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]), C(2), A(2));
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]), C(1), A(1, 1));
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]), C(2), A(1, 2));
M m1_save = m1;
M m2_save = m2;
swap(m1, m2);
assert(m1 == m2_save);
assert(m2 == m1_save);
assert(m1.key_comp() == C(2));
- assert(m1.get_allocator() == A(1));
+ assert(m1.get_allocator().get_id() == 1); // not swapped
assert(m2.key_comp() == C(1));
- assert(m2.get_allocator() == A(2));
+ assert(m2.get_allocator().get_id() == 2);
}
{
typedef other_allocator<V> A;
Modified: libcxx/trunk/test/std/containers/associative/multimap/multimap.special/non_member_swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multimap/multimap.special/non_member_swap.pass.cpp?rev=289358&r1=289357&r2=289358&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multimap/multimap.special/non_member_swap.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/associative/multimap/multimap.special/non_member_swap.pass.cpp Sat Dec 10 21:41:12 2016
@@ -155,17 +155,17 @@ int main()
V(11, 11),
V(12, 12)
};
- M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]), C(1), A(1));
- M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]), C(2), A(2));
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]), C(1), A(1, 1));
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]), C(2), A(1, 2));
M m1_save = m1;
M m2_save = m2;
swap(m1, m2);
assert(m1 == m2_save);
assert(m2 == m1_save);
assert(m1.key_comp() == C(2));
- assert(m1.get_allocator() == A(2));
+ assert(m1.get_allocator().get_id() == 1); // not swapped
assert(m2.key_comp() == C(1));
- assert(m2.get_allocator() == A(1));
+ assert(m2.get_allocator().get_id() == 2);
}
#if TEST_STD_VER >= 11
{
Modified: libcxx/trunk/test/std/containers/associative/multiset/multiset.special/non_member_swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multiset/multiset.special/non_member_swap.pass.cpp?rev=289358&r1=289357&r2=289358&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/associative/multiset/multiset.special/non_member_swap.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/associative/multiset/multiset.special/non_member_swap.pass.cpp Sat Dec 10 21:41:12 2016
@@ -118,17 +118,17 @@ int main()
11,
12
};
- M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]), C(1), A(1));
- M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]), C(2), A(2));
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]), C(1), A(1, 1));
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]), C(2), A(1, 2));
M m1_save = m1;
M m2_save = m2;
swap(m1, m2);
assert(m1 == m2_save);
assert(m2 == m1_save);
assert(m1.key_comp() == C(2));
- assert(m1.get_allocator() == A(1));
+ assert(m1.get_allocator().get_id() == 1);
assert(m2.key_comp() == C(1));
- assert(m2.get_allocator() == A(2));
+ assert(m2.get_allocator().get_id() == 2);
}
{
typedef other_allocator<V> A;
Modified: libcxx/trunk/test/std/containers/associative/set/set.special/non_member_swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/set/set.special/non_member_swap.pass.cpp?rev=289358&r1=289357&r2=289358&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/associative/set/set.special/non_member_swap.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/associative/set/set.special/non_member_swap.pass.cpp Sat Dec 10 21:41:12 2016
@@ -118,17 +118,17 @@ int main()
11,
12
};
- M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]), C(1), A(1));
- M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]), C(2), A(2));
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]), C(1), A(1, 1));
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]), C(2), A(1, 2));
M m1_save = m1;
M m2_save = m2;
swap(m1, m2);
assert(m1 == m2_save);
assert(m2 == m1_save);
assert(m1.key_comp() == C(2));
- assert(m1.get_allocator() == A(1));
+ assert(m1.get_allocator().get_id() == 1);
assert(m2.key_comp() == C(1));
- assert(m2.get_allocator() == A(2));
+ assert(m2.get_allocator().get_id() == 2);
}
{
typedef other_allocator<V> A;
Modified: libcxx/trunk/test/std/containers/sequences/deque/deque.special/swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.special/swap.pass.cpp?rev=289358&r1=289357&r2=289358&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/deque/deque.special/swap.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/sequences/deque/deque.special/swap.pass.cpp Sat Dec 10 21:41:12 2016
@@ -65,13 +65,13 @@ int main()
int a1[] = {1, 3, 7, 9, 10};
int a2[] = {0, 2, 4, 5, 6, 8, 11};
typedef test_allocator<int> A;
- std::deque<int, A> c1(a1, a1+sizeof(a1)/sizeof(a1[0]), A(1));
- std::deque<int, A> c2(a2, a2+sizeof(a2)/sizeof(a2[0]), A(2));
+ std::deque<int, A> c1(a1, a1+sizeof(a1)/sizeof(a1[0]), A(1, 1));
+ std::deque<int, A> c2(a2, a2+sizeof(a2)/sizeof(a2[0]), A(1, 2));
swap(c1, c2);
assert((c1 == std::deque<int, A>(a2, a2+sizeof(a2)/sizeof(a2[0]))));
- assert(c1.get_allocator() == A(1));
+ assert(c1.get_allocator().get_id() == 1);
assert((c2 == std::deque<int, A>(a1, a1+sizeof(a1)/sizeof(a1[0]))));
- assert(c2.get_allocator() == A(2));
+ assert(c2.get_allocator().get_id() == 2);
}
{
int a1[] = {1, 3, 7, 9, 10};
Modified: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.spec/member_swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.spec/member_swap.pass.cpp?rev=289358&r1=289357&r2=289358&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.spec/member_swap.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.spec/member_swap.pass.cpp Sat Dec 10 21:41:12 2016
@@ -24,16 +24,16 @@ int main()
typedef test_allocator<T> A;
typedef std::forward_list<T, A> C;
const T t1[] = {0, 1, 2, 3, 4, 5};
- C c1(std::begin(t1), std::end(t1), A(1));
+ C c1(std::begin(t1), std::end(t1), A(1, 1));
const T t2[] = {10, 11, 12};
- C c2(std::begin(t2), std::end(t2), A(2));
+ C c2(std::begin(t2), std::end(t2), A(1, 2));
c1.swap(c2);
assert(distance(c1.begin(), c1.end()) == 3);
assert(*next(c1.begin(), 0) == 10);
assert(*next(c1.begin(), 1) == 11);
assert(*next(c1.begin(), 2) == 12);
- assert(c1.get_allocator() == A(1));
+ assert(c1.get_allocator().get_id() == 1);
assert(distance(c2.begin(), c2.end()) == 6);
assert(*next(c2.begin(), 0) == 0);
@@ -42,19 +42,19 @@ int main()
assert(*next(c2.begin(), 3) == 3);
assert(*next(c2.begin(), 4) == 4);
assert(*next(c2.begin(), 5) == 5);
- assert(c2.get_allocator() == A(2));
+ assert(c2.get_allocator().get_id() == 2);
}
{
typedef int T;
typedef test_allocator<T> A;
typedef std::forward_list<T, A> C;
const T t1[] = {0, 1, 2, 3, 4, 5};
- C c1(std::begin(t1), std::end(t1), A(1));
- C c2(A(2));
+ C c1(std::begin(t1), std::end(t1), A(1, 1));
+ C c2(A(1, 2));
c1.swap(c2);
assert(distance(c1.begin(), c1.end()) == 0);
- assert(c1.get_allocator() == A(1));
+ assert(c1.get_allocator().get_id() == 1);
assert(distance(c2.begin(), c2.end()) == 6);
assert(*next(c2.begin(), 0) == 0);
@@ -63,39 +63,39 @@ int main()
assert(*next(c2.begin(), 3) == 3);
assert(*next(c2.begin(), 4) == 4);
assert(*next(c2.begin(), 5) == 5);
- assert(c2.get_allocator() == A(2));
+ assert(c2.get_allocator().get_id() == 2);
}
{
typedef int T;
typedef test_allocator<T> A;
typedef std::forward_list<T, A> C;
- C c1(A(1));
+ C c1(A(1, 1));
const T t2[] = {10, 11, 12};
- C c2(std::begin(t2), std::end(t2), A(2));
+ C c2(std::begin(t2), std::end(t2), A(1, 2));
c1.swap(c2);
assert(distance(c1.begin(), c1.end()) == 3);
assert(*next(c1.begin(), 0) == 10);
assert(*next(c1.begin(), 1) == 11);
assert(*next(c1.begin(), 2) == 12);
- assert(c1.get_allocator() == A(1));
+ assert(c1.get_allocator().get_id() == 1);
assert(distance(c2.begin(), c2.end()) == 0);
- assert(c2.get_allocator() == A(2));
+ assert(c2.get_allocator().get_id() == 2);
}
{
typedef int T;
typedef test_allocator<T> A;
typedef std::forward_list<T, A> C;
- C c1(A(1));
- C c2(A(2));
+ C c1(A(1, 1));
+ C c2(A(1, 2));
c1.swap(c2);
assert(distance(c1.begin(), c1.end()) == 0);
- assert(c1.get_allocator() == A(1));
+ assert(c1.get_allocator().get_id() == 1);
assert(distance(c2.begin(), c2.end()) == 0);
- assert(c2.get_allocator() == A(2));
+ assert(c2.get_allocator().get_id() == 2);
}
{
Modified: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.spec/non_member_swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.spec/non_member_swap.pass.cpp?rev=289358&r1=289357&r2=289358&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.spec/non_member_swap.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.spec/non_member_swap.pass.cpp Sat Dec 10 21:41:12 2016
@@ -25,16 +25,16 @@ int main()
typedef test_allocator<T> A;
typedef std::forward_list<T, A> C;
const T t1[] = {0, 1, 2, 3, 4, 5};
- C c1(std::begin(t1), std::end(t1), A(1));
+ C c1(std::begin(t1), std::end(t1), A(1, 1));
const T t2[] = {10, 11, 12};
- C c2(std::begin(t2), std::end(t2), A(2));
+ C c2(std::begin(t2), std::end(t2), A(1, 2));
swap(c1, c2);
assert(distance(c1.begin(), c1.end()) == 3);
assert(*next(c1.begin(), 0) == 10);
assert(*next(c1.begin(), 1) == 11);
assert(*next(c1.begin(), 2) == 12);
- assert(c1.get_allocator() == A(1));
+ assert(c1.get_allocator().get_id() == 1);
assert(distance(c2.begin(), c2.end()) == 6);
assert(*next(c2.begin(), 0) == 0);
@@ -43,19 +43,19 @@ int main()
assert(*next(c2.begin(), 3) == 3);
assert(*next(c2.begin(), 4) == 4);
assert(*next(c2.begin(), 5) == 5);
- assert(c2.get_allocator() == A(2));
+ assert(c2.get_allocator().get_id() == 2);
}
{
typedef int T;
typedef test_allocator<T> A;
typedef std::forward_list<T, A> C;
const T t1[] = {0, 1, 2, 3, 4, 5};
- C c1(std::begin(t1), std::end(t1), A(1));
- C c2(A(2));
+ C c1(std::begin(t1), std::end(t1), A(1, 1));
+ C c2(A(1, 2));
swap(c1, c2);
assert(distance(c1.begin(), c1.end()) == 0);
- assert(c1.get_allocator() == A(1));
+ assert(c1.get_allocator().get_id() == 1);
assert(distance(c2.begin(), c2.end()) == 6);
assert(*next(c2.begin(), 0) == 0);
@@ -64,39 +64,39 @@ int main()
assert(*next(c2.begin(), 3) == 3);
assert(*next(c2.begin(), 4) == 4);
assert(*next(c2.begin(), 5) == 5);
- assert(c2.get_allocator() == A(2));
+ assert(c2.get_allocator().get_id() == 2);
}
{
typedef int T;
typedef test_allocator<T> A;
typedef std::forward_list<T, A> C;
- C c1(A(1));
+ C c1(A(1, 1));
const T t2[] = {10, 11, 12};
- C c2(std::begin(t2), std::end(t2), A(2));
+ C c2(std::begin(t2), std::end(t2), A(1, 2));
swap(c1, c2);
assert(distance(c1.begin(), c1.end()) == 3);
assert(*next(c1.begin(), 0) == 10);
assert(*next(c1.begin(), 1) == 11);
assert(*next(c1.begin(), 2) == 12);
- assert(c1.get_allocator() == A(1));
+ assert(c1.get_allocator().get_id() == 1);
assert(distance(c2.begin(), c2.end()) == 0);
- assert(c2.get_allocator() == A(2));
+ assert(c2.get_allocator().get_id() == 2);
}
{
typedef int T;
typedef test_allocator<T> A;
typedef std::forward_list<T, A> C;
- C c1(A(1));
- C c2(A(2));
+ C c1(A(1, 1));
+ C c2(A(1, 2));
swap(c1, c2);
assert(distance(c1.begin(), c1.end()) == 0);
- assert(c1.get_allocator() == A(1));
+ assert(c1.get_allocator().get_id() == 1);
assert(distance(c2.begin(), c2.end()) == 0);
- assert(c2.get_allocator() == A(2));
+ assert(c2.get_allocator().get_id() == 2);
}
{
Modified: libcxx/trunk/test/std/containers/sequences/vector.bool/swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/vector.bool/swap.pass.cpp?rev=289358&r1=289357&r2=289358&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/vector.bool/swap.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/sequences/vector.bool/swap.pass.cpp Sat Dec 10 21:41:12 2016
@@ -30,15 +30,15 @@ int main()
}
{
typedef test_allocator<bool> A;
- std::vector<bool, A> v1(100, true, A(1));
- std::vector<bool, A> v2(200, false, A(2));
+ std::vector<bool, A> v1(100, true, A(1, 1));
+ std::vector<bool, A> v2(200, false, A(1, 2));
swap(v1, v2);
assert(v1.size() == 200);
assert(v1.capacity() >= 200);
assert(v2.size() == 100);
assert(v2.capacity() >= 100);
- assert(v1.get_allocator() == A(1));
- assert(v2.get_allocator() == A(2));
+ assert(v1.get_allocator().get_id() == 1);
+ assert(v2.get_allocator().get_id() == 2);
}
{
typedef other_allocator<bool> A;
Modified: libcxx/trunk/test/std/containers/sequences/vector/vector.special/swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/vector/vector.special/swap.pass.cpp?rev=289358&r1=289357&r2=289358&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/vector/vector.special/swap.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/sequences/vector/vector.special/swap.pass.cpp Sat Dec 10 21:41:12 2016
@@ -77,21 +77,18 @@ int main()
assert(is_contiguous_container_asan_correct(c1));
assert(is_contiguous_container_asan_correct(c2));
}
-#ifndef _LIBCPP_DEBUG_LEVEL
-// This test known to result in undefined behavior detected by _LIBCPP_DEBUG_LEVEL >= 1
{
int a1[] = {1, 3, 7, 9, 10};
int a2[] = {0, 2, 4, 5, 6, 8, 11};
typedef test_allocator<int> A;
- std::vector<int, A> c1(a1, a1+sizeof(a1)/sizeof(a1[0]), A(1));
- std::vector<int, A> c2(a2, a2+sizeof(a2)/sizeof(a2[0]), A(2));
+ std::vector<int, A> c1(a1, a1+sizeof(a1)/sizeof(a1[0]), A(1, 1));
+ std::vector<int, A> c2(a2, a2+sizeof(a2)/sizeof(a2[0]), A(1, 2));
swap(c1, c2);
assert((c1 == std::vector<int, A>(a2, a2+sizeof(a2)/sizeof(a2[0]))));
- assert(c1.get_allocator() == A(1));
+ assert(c1.get_allocator().get_id() == 1);
assert((c2 == std::vector<int, A>(a1, a1+sizeof(a1)/sizeof(a1[0]))));
- assert(c2.get_allocator() == A(2));
+ assert(c2.get_allocator().get_id() == 2);
}
-#endif
{
int a1[] = {1, 3, 7, 9, 10};
int a2[] = {0, 2, 4, 5, 6, 8, 11};
Modified: libcxx/trunk/test/std/containers/unord/unord.map/swap_member.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/unord/unord.map/swap_member.pass.cpp?rev=289358&r1=289357&r2=289358&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/unord/unord.map/swap_member.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/unord/unord.map/swap_member.pass.cpp Sat Dec 10 21:41:12 2016
@@ -33,8 +33,8 @@ int main()
typedef test_compare<std::equal_to<int> > Compare;
typedef test_allocator<std::pair<const int, std::string> > Alloc;
typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
- C c1(0, Hash(1), Compare(1), Alloc(1));
- C c2(0, Hash(2), Compare(2), Alloc(2));
+ C c1(0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
c1.swap(c2);
@@ -42,7 +42,7 @@ int main()
assert(c1.size() == 0);
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(1));
+ assert(c1.get_allocator().get_id() == 1);
assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
@@ -51,7 +51,7 @@ int main()
assert(c2.size() == 0);
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(2));
+ assert(c2.get_allocator().get_id() == 2);
assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
@@ -73,8 +73,8 @@ int main()
P(70, "seventy"),
P(80, "eighty"),
};
- C c1(0, Hash(1), Compare(1), Alloc(1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
+ C c1(0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
c1.swap(c2);
@@ -90,7 +90,7 @@ int main()
assert(c1.at(80) == "eighty");
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(1));
+ assert(c1.get_allocator().get_id() == 1);
assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
@@ -99,7 +99,7 @@ int main()
assert(c2.size() == 0);
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(2));
+ assert(c2.get_allocator().get_id() == 2);
assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
@@ -119,8 +119,8 @@ int main()
P(1, "four"),
P(2, "four"),
};
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
- C c2(0, Hash(2), Compare(2), Alloc(2));
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
c1.swap(c2);
@@ -128,7 +128,7 @@ int main()
assert(c1.size() == 0);
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(1));
+ assert(c1.get_allocator().get_id() == 1);
assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
@@ -141,7 +141,7 @@ int main()
assert(c2.at(4) == "four");
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(2));
+ assert(c2.get_allocator().get_id() == 2);
assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
@@ -172,8 +172,8 @@ int main()
P(70, "seventy"),
P(80, "eighty"),
};
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
c1.swap(c2);
@@ -189,7 +189,7 @@ int main()
assert(c1.at(80) == "eighty");
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(1));
+ assert(c1.get_allocator().get_id() == 1);
assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
@@ -202,7 +202,7 @@ int main()
assert(c2.at(4) == "four");
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(2));
+ assert(c2.get_allocator().get_id() == 2);
assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
Modified: libcxx/trunk/test/std/containers/unord/unord.map/unord.map.swap/swap_non_member.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/unord/unord.map/unord.map.swap/swap_non_member.pass.cpp?rev=289358&r1=289357&r2=289358&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/unord/unord.map/unord.map.swap/swap_non_member.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/unord/unord.map/unord.map.swap/swap_non_member.pass.cpp Sat Dec 10 21:41:12 2016
@@ -33,8 +33,8 @@ int main()
typedef test_compare<std::equal_to<int> > Compare;
typedef test_allocator<std::pair<const int, std::string> > Alloc;
typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
- C c1(0, Hash(1), Compare(1), Alloc(1));
- C c2(0, Hash(2), Compare(2), Alloc(2));
+ C c1(0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
swap(c1, c2);
@@ -42,7 +42,7 @@ int main()
assert(c1.size() == 0);
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(1));
+ assert(c1.get_allocator().get_id() == 1);
assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
@@ -51,7 +51,7 @@ int main()
assert(c2.size() == 0);
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(2));
+ assert(c2.get_allocator().get_id() == 2);
assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
@@ -73,8 +73,8 @@ int main()
P(70, "seventy"),
P(80, "eighty"),
};
- C c1(0, Hash(1), Compare(1), Alloc(1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
+ C c1(0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
swap(c1, c2);
@@ -90,7 +90,7 @@ int main()
assert(c1.at(80) == "eighty");
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(1));
+ assert(c1.get_allocator().get_id() == 1);
assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
@@ -99,7 +99,7 @@ int main()
assert(c2.size() == 0);
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(2));
+ assert(c2.get_allocator().get_id() == 2);
assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
@@ -119,8 +119,8 @@ int main()
P(1, "four"),
P(2, "four"),
};
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
- C c2(0, Hash(2), Compare(2), Alloc(2));
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
swap(c1, c2);
@@ -128,7 +128,7 @@ int main()
assert(c1.size() == 0);
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(1));
+ assert(c1.get_allocator().get_id() == 1);
assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
@@ -141,7 +141,7 @@ int main()
assert(c2.at(4) == "four");
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(2));
+ assert(c2.get_allocator().get_id() == 2);
assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
@@ -172,8 +172,8 @@ int main()
P(70, "seventy"),
P(80, "eighty"),
};
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
swap(c1, c2);
@@ -189,7 +189,7 @@ int main()
assert(c1.at(80) == "eighty");
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(1));
+ assert(c1.get_allocator().get_id() == 1);
assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
@@ -202,7 +202,7 @@ int main()
assert(c2.at(4) == "four");
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(2));
+ assert(c2.get_allocator().get_id() == 2);
assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
Modified: libcxx/trunk/test/std/containers/unord/unord.multimap/swap_member.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/unord/unord.multimap/swap_member.pass.cpp?rev=289358&r1=289357&r2=289358&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/unord/unord.multimap/swap_member.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/unord/unord.multimap/swap_member.pass.cpp Sat Dec 10 21:41:12 2016
@@ -44,7 +44,7 @@ int main()
assert(c1.size() == 0);
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(1));
+ assert(c1.get_allocator().get_id() == 1);
assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
@@ -53,7 +53,7 @@ int main()
assert(c2.size() == 0);
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(2));
+ assert(c2.get_allocator().get_id() == 2);
assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
@@ -92,7 +92,7 @@ int main()
assert(c1.find(80)->second == "eighty");
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(1));
+ assert(c1.get_allocator().get_id() == 1);
assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
@@ -101,7 +101,7 @@ int main()
assert(c2.size() == 0);
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(2));
+ assert(c2.get_allocator().get_id() == 2);
assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
@@ -130,7 +130,7 @@ int main()
assert(c1.size() == 0);
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(1));
+ assert(c1.get_allocator().get_id() == 1);
assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
@@ -145,7 +145,7 @@ int main()
assert(c2.find(4)->second == "four");
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(2));
+ assert(c2.get_allocator().get_id() == 2);
assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
@@ -193,7 +193,7 @@ int main()
assert(c1.find(80)->second == "eighty");
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(1));
+ assert(c1.get_allocator().get_id() == 1);
assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
@@ -208,7 +208,7 @@ int main()
assert(c2.find(4)->second == "four");
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(2));
+ assert(c2.get_allocator().get_id() == 2);
assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
Modified: libcxx/trunk/test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_non_member.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_non_member.pass.cpp?rev=289358&r1=289357&r2=289358&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_non_member.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_non_member.pass.cpp Sat Dec 10 21:41:12 2016
@@ -34,8 +34,8 @@ int main()
typedef test_allocator<std::pair<const int, std::string> > Alloc;
typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
typedef std::pair<int, std::string> P;
- C c1(0, Hash(1), Compare(1), Alloc(1));
- C c2(0, Hash(2), Compare(2), Alloc(2));
+ C c1(0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
swap(c1, c2);
@@ -43,7 +43,7 @@ int main()
assert(c1.size() == 0);
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(1));
+ assert(c1.get_allocator().get_id() == 1);
assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
@@ -52,7 +52,7 @@ int main()
assert(c2.size() == 0);
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(2));
+ assert(c2.get_allocator().get_id() == 2);
assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
@@ -74,8 +74,8 @@ int main()
P(70, "seventy"),
P(80, "eighty"),
};
- C c1(0, Hash(1), Compare(1), Alloc(1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
+ C c1(0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
swap(c1, c2);
@@ -91,7 +91,7 @@ int main()
assert(c1.find(80)->second == "eighty");
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(1));
+ assert(c1.get_allocator().get_id() == 1);
assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
@@ -100,7 +100,7 @@ int main()
assert(c2.size() == 0);
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(2));
+ assert(c2.get_allocator().get_id() == 2);
assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
@@ -120,8 +120,8 @@ int main()
P(1, "four"),
P(2, "four"),
};
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
- C c2(0, Hash(2), Compare(2), Alloc(2));
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
swap(c1, c2);
@@ -129,7 +129,7 @@ int main()
assert(c1.size() == 0);
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(1));
+ assert(c1.get_allocator().get_id() == 1);
assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
@@ -144,7 +144,7 @@ int main()
assert(c2.find(4)->second == "four");
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(2));
+ assert(c2.get_allocator().get_id() == 2);
assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
@@ -175,8 +175,8 @@ int main()
P(70, "seventy"),
P(80, "eighty"),
};
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
swap(c1, c2);
@@ -192,7 +192,7 @@ int main()
assert(c1.find(80)->second == "eighty");
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(1));
+ assert(c1.get_allocator().get_id() == 1);
assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
@@ -207,7 +207,7 @@ int main()
assert(c2.find(4)->second == "four");
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(2));
+ assert(c2.get_allocator().get_id() == 2);
assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
Modified: libcxx/trunk/test/std/containers/unord/unord.multiset/swap_member.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/unord/unord.multiset/swap_member.pass.cpp?rev=289358&r1=289357&r2=289358&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/unord/unord.multiset/swap_member.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/unord/unord.multiset/swap_member.pass.cpp Sat Dec 10 21:41:12 2016
@@ -33,8 +33,8 @@ int main()
typedef test_allocator<int> Alloc;
typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
typedef int P;
- C c1(0, Hash(1), Compare(1), Alloc(1));
- C c2(0, Hash(2), Compare(2), Alloc(2));
+ C c1(0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
c1.swap(c2);
@@ -42,7 +42,7 @@ int main()
assert(c1.size() == 0);
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(1));
+ assert(c1.get_allocator().get_id() == 1);
assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
@@ -51,7 +51,7 @@ int main()
assert(c2.size() == 0);
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(2));
+ assert(c2.get_allocator().get_id() == 2);
assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
@@ -73,8 +73,8 @@ int main()
P(70),
P(80)
};
- C c1(0, Hash(1), Compare(1), Alloc(1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
+ C c1(0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
c1.swap(c2);
@@ -90,7 +90,7 @@ int main()
assert(*c1.find(80) == 80);
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(1));
+ assert(c1.get_allocator().get_id() == 1);
assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
@@ -99,7 +99,7 @@ int main()
assert(c2.size() == 0);
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(2));
+ assert(c2.get_allocator().get_id() == 2);
assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
@@ -119,8 +119,8 @@ int main()
P(1),
P(2)
};
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
- C c2(0, Hash(2), Compare(2), Alloc(2));
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
c1.swap(c2);
@@ -128,7 +128,7 @@ int main()
assert(c1.size() == 0);
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(1));
+ assert(c1.get_allocator().get_id() == 1);
assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
@@ -141,7 +141,7 @@ int main()
assert(c2.count(4) == 1);
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(2));
+ assert(c2.get_allocator().get_id() == 2);
assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
@@ -172,8 +172,8 @@ int main()
P(70),
P(80)
};
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
c1.swap(c2);
@@ -189,7 +189,7 @@ int main()
assert(*c1.find(80) == 80);
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(1));
+ assert(c1.get_allocator().get_id() == 1);
assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
@@ -202,7 +202,7 @@ int main()
assert(c2.count(4) == 1);
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(2));
+ assert(c2.get_allocator().get_id() == 2);
assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
Modified: libcxx/trunk/test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_non_member.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_non_member.pass.cpp?rev=289358&r1=289357&r2=289358&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_non_member.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_non_member.pass.cpp Sat Dec 10 21:41:12 2016
@@ -33,8 +33,8 @@ int main()
typedef test_allocator<int> Alloc;
typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
typedef int P;
- C c1(0, Hash(1), Compare(1), Alloc(1));
- C c2(0, Hash(2), Compare(2), Alloc(2));
+ C c1(0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
swap(c1, c2);
@@ -42,7 +42,7 @@ int main()
assert(c1.size() == 0);
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(1));
+ assert(c1.get_allocator().get_id() == 1);
assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
@@ -51,7 +51,7 @@ int main()
assert(c2.size() == 0);
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(2));
+ assert(c2.get_allocator().get_id() == 2);
assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
@@ -73,8 +73,8 @@ int main()
P(70),
P(80)
};
- C c1(0, Hash(1), Compare(1), Alloc(1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
+ C c1(0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
swap(c1, c2);
@@ -90,7 +90,7 @@ int main()
assert(*c1.find(80) == 80);
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(1));
+ assert(c1.get_allocator().get_id() == 1);
assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
@@ -99,7 +99,7 @@ int main()
assert(c2.size() == 0);
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(2));
+ assert(c2.get_allocator().get_id() == 2);
assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
@@ -119,8 +119,8 @@ int main()
P(1),
P(2)
};
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
- C c2(0, Hash(2), Compare(2), Alloc(2));
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
swap(c1, c2);
@@ -128,7 +128,7 @@ int main()
assert(c1.size() == 0);
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(1));
+ assert(c1.get_allocator().get_id() == 1);
assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
@@ -141,7 +141,7 @@ int main()
assert(c2.count(4) == 1);
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(2));
+ assert(c2.get_allocator().get_id() == 2);
assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
@@ -172,8 +172,8 @@ int main()
P(70),
P(80)
};
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
swap(c1, c2);
@@ -189,7 +189,7 @@ int main()
assert(*c1.find(80) == 80);
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(1));
+ assert(c1.get_allocator().get_id() == 1);
assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
@@ -202,7 +202,7 @@ int main()
assert(c2.count(4) == 1);
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(2));
+ assert(c2.get_allocator().get_id() == 2);
assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
Modified: libcxx/trunk/test/std/containers/unord/unord.set/swap_member.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/unord/unord.set/swap_member.pass.cpp?rev=289358&r1=289357&r2=289358&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/unord/unord.set/swap_member.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/unord/unord.set/swap_member.pass.cpp Sat Dec 10 21:41:12 2016
@@ -33,8 +33,8 @@ int main()
typedef test_allocator<int> Alloc;
typedef std::unordered_set<int, Hash, Compare, Alloc> C;
typedef int P;
- C c1(0, Hash(1), Compare(1), Alloc(1));
- C c2(0, Hash(2), Compare(2), Alloc(2));
+ C c1(0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
c1.swap(c2);
@@ -42,7 +42,7 @@ int main()
assert(c1.size() == 0);
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(1));
+ assert(c1.get_allocator().get_id() == 1);
assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
@@ -51,7 +51,7 @@ int main()
assert(c2.size() == 0);
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(2));
+ assert(c2.get_allocator().get_id() == 2);
assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
@@ -73,8 +73,8 @@ int main()
P(70),
P(80)
};
- C c1(0, Hash(1), Compare(1), Alloc(1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
+ C c1(0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
c1.swap(c2);
@@ -90,7 +90,7 @@ int main()
assert(*c1.find(80) == 80);
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(1));
+ assert(c1.get_allocator().get_id() == 1);
assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
@@ -99,7 +99,7 @@ int main()
assert(c2.size() == 0);
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(2));
+ assert(c2.get_allocator().get_id() == 2);
assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
@@ -119,8 +119,8 @@ int main()
P(1),
P(2)
};
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
- C c2(0, Hash(2), Compare(2), Alloc(2));
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
c1.swap(c2);
@@ -128,7 +128,7 @@ int main()
assert(c1.size() == 0);
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(1));
+ assert(c1.get_allocator().get_id() == 1);
assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
@@ -141,7 +141,7 @@ int main()
assert(c2.count(4) == 1);
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(2));
+ assert(c2.get_allocator().get_id() == 2);
assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
@@ -172,8 +172,8 @@ int main()
P(70),
P(80)
};
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
c1.swap(c2);
@@ -189,7 +189,7 @@ int main()
assert(*c1.find(80) == 80);
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(1));
+ assert(c1.get_allocator().get_id() == 1);
assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
@@ -202,7 +202,7 @@ int main()
assert(c2.count(4) == 1);
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(2));
+ assert(c2.get_allocator().get_id() == 2);
assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
Modified: libcxx/trunk/test/std/containers/unord/unord.set/unord.set.swap/swap_non_member.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/unord/unord.set/unord.set.swap/swap_non_member.pass.cpp?rev=289358&r1=289357&r2=289358&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/unord/unord.set/unord.set.swap/swap_non_member.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/unord/unord.set/unord.set.swap/swap_non_member.pass.cpp Sat Dec 10 21:41:12 2016
@@ -33,8 +33,8 @@ int main()
typedef test_allocator<int> Alloc;
typedef std::unordered_set<int, Hash, Compare, Alloc> C;
typedef int P;
- C c1(0, Hash(1), Compare(1), Alloc(1));
- C c2(0, Hash(2), Compare(2), Alloc(2));
+ C c1(0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
swap(c1, c2);
@@ -42,7 +42,7 @@ int main()
assert(c1.size() == 0);
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(1));
+ assert(c1.get_allocator().get_id() == 1);
assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
@@ -51,7 +51,7 @@ int main()
assert(c2.size() == 0);
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(2));
+ assert(c2.get_allocator().get_id() == 2);
assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
@@ -73,8 +73,8 @@ int main()
P(70),
P(80)
};
- C c1(0, Hash(1), Compare(1), Alloc(1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
+ C c1(0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
swap(c1, c2);
@@ -90,7 +90,7 @@ int main()
assert(*c1.find(80) == 80);
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(1));
+ assert(c1.get_allocator().get_id() == 1);
assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
@@ -99,7 +99,7 @@ int main()
assert(c2.size() == 0);
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(2));
+ assert(c2.get_allocator().get_id() == 2);
assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
@@ -119,8 +119,8 @@ int main()
P(1),
P(2)
};
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
- C c2(0, Hash(2), Compare(2), Alloc(2));
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
swap(c1, c2);
@@ -128,7 +128,7 @@ int main()
assert(c1.size() == 0);
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(1));
+ assert(c1.get_allocator().get_id() == 1);
assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
@@ -141,7 +141,7 @@ int main()
assert(c2.count(4) == 1);
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(2));
+ assert(c2.get_allocator().get_id() == 2);
assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
@@ -172,8 +172,8 @@ int main()
P(70),
P(80)
};
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
swap(c1, c2);
@@ -189,7 +189,7 @@ int main()
assert(*c1.find(80) == 80);
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(1));
+ assert(c1.get_allocator().get_id() == 1);
assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
@@ -202,7 +202,7 @@ int main()
assert(c2.count(4) == 1);
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(2));
+ assert(c2.get_allocator().get_id() == 2);
assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
Modified: libcxx/trunk/test/support/test_allocator.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/test_allocator.h?rev=289358&r1=289357&r2=289358&view=diff
==============================================================================
--- libcxx/trunk/test/support/test_allocator.h (original)
+++ libcxx/trunk/test/support/test_allocator.h Sat Dec 10 21:41:12 2016
@@ -13,6 +13,7 @@
#include <type_traits>
#include <new>
#include <memory>
+#include <utility>
#include <cstddef>
#include <cstdlib>
#include <climits>
@@ -46,8 +47,8 @@ template <class T>
class test_allocator
: public test_alloc_base
{
- int data_;
-
+ int data_; // participates in equality
+ int id_; // unique identifier, doesn't participate in equality
template <class U> friend class test_allocator;
public:
@@ -61,13 +62,17 @@ public:
template <class U> struct rebind {typedef test_allocator<U> other;};
- test_allocator() TEST_NOEXCEPT : data_(0) {++count;}
- explicit test_allocator(int i) TEST_NOEXCEPT : data_(i) {++count;}
+ test_allocator() TEST_NOEXCEPT : data_(0), id_(0) {++count;}
+ explicit test_allocator(int i, int id = 0) TEST_NOEXCEPT : data_(i), id_(id)
+ {++count;}
test_allocator(const test_allocator& a) TEST_NOEXCEPT
- : data_(a.data_) {++count;}
+ : data_(a.data_), id_(a.id_) {++count;}
template <class U> test_allocator(const test_allocator<U>& a) TEST_NOEXCEPT
- : data_(a.data_) {++count;}
- ~test_allocator() TEST_NOEXCEPT {assert(data_ >= 0); --count; data_ = -1;}
+ : data_(a.data_), id_(a.id_) {++count;}
+ ~test_allocator() TEST_NOEXCEPT {
+ assert(data_ >= 0); assert(id_ >= 0);
+ --count; data_ = -1; id_ = -1;
+ }
pointer address(reference x) const {return &x;}
const_pointer address(const_reference x) const {return &x;}
pointer allocate(size_type n, const void* = 0)
@@ -101,6 +106,9 @@ public:
{return x.data_ == y.data_;}
friend bool operator!=(const test_allocator& x, const test_allocator& y)
{return !(x == y);}
+
+ int get_data() const { return data_; }
+ int get_id() const { return id_; }
};
template <class T>
@@ -169,6 +177,7 @@ class test_allocator<void>
: public test_alloc_base
{
int data_;
+ int id_;
template <class U> friend class test_allocator;
public:
@@ -181,13 +190,16 @@ public:
template <class U> struct rebind {typedef test_allocator<U> other;};
- test_allocator() TEST_NOEXCEPT : data_(0) {}
- explicit test_allocator(int i) TEST_NOEXCEPT : data_(i) {}
+ test_allocator() TEST_NOEXCEPT : data_(0), id_(0) {}
+ explicit test_allocator(int i, int id = 0) TEST_NOEXCEPT : data_(i), id_(id) {}
test_allocator(const test_allocator& a) TEST_NOEXCEPT
- : data_(a.data_) {}
+ : data_(a.data_), id_(a.id_) {}
template <class U> test_allocator(const test_allocator<U>& a) TEST_NOEXCEPT
- : data_(a.data_) {}
- ~test_allocator() TEST_NOEXCEPT {data_ = -1;}
+ : data_(a.data_), id_(a.id_) {}
+ ~test_allocator() TEST_NOEXCEPT {data_ = -1; id_ = -1; }
+
+ int get_id() const { return id_; }
+ int get_data() const { return data_; }
friend bool operator==(const test_allocator& x, const test_allocator& y)
{return x.data_ == y.data_;}
More information about the cfe-commits
mailing list