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;
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
{
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;
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;
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};
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);
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);
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);
}
{
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);
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);
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);
}
{
}
{
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;
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};
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
#include <type_traits>
#include <new>
#include <memory>
+#include <utility>
#include <cstddef>
#include <cstdlib>
#include <climits>
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:
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)
{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>
: public test_alloc_base
{
int data_;
+ int id_;
template <class U> friend class test_allocator;
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_;}