summaryrefslogtreecommitdiffstats
path: root/libcxx/test/containers
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/test/containers')
-rw-r--r--libcxx/test/containers/associative/map/map.access/at.pass.cpp68
-rw-r--r--libcxx/test/containers/associative/map/map.access/empty.pass.cpp15
-rw-r--r--libcxx/test/containers/associative/map/map.access/index_key.pass.cpp32
-rw-r--r--libcxx/test/containers/associative/map/map.access/index_rv_key.pass.cpp20
-rw-r--r--libcxx/test/containers/associative/map/map.access/iterator.pass.cpp90
-rw-r--r--libcxx/test/containers/associative/map/map.access/max_size.pass.cpp11
-rw-r--r--libcxx/test/containers/associative/map/map.access/size.pass.cpp23
-rw-r--r--libcxx/test/containers/associative/map/map.cons/alloc.pass.cpp13
-rw-r--r--libcxx/test/containers/associative/map/map.cons/assign_initializer_list.pass.cpp30
-rw-r--r--libcxx/test/containers/associative/map/map.cons/compare.pass.cpp12
-rw-r--r--libcxx/test/containers/associative/map/map.cons/compare_alloc.pass.cpp14
-rw-r--r--libcxx/test/containers/associative/map/map.cons/copy.pass.cpp37
-rw-r--r--libcxx/test/containers/associative/map/map.cons/copy_alloc.pass.cpp39
-rw-r--r--libcxx/test/containers/associative/map/map.cons/copy_assign.pass.cpp73
-rw-r--r--libcxx/test/containers/associative/map/map.cons/default.pass.cpp11
-rw-r--r--libcxx/test/containers/associative/map/map.cons/default_recursive.pass.cpp2
-rw-r--r--libcxx/test/containers/associative/map/map.cons/initializer_list.pass.cpp26
-rw-r--r--libcxx/test/containers/associative/map/map.cons/initializer_list_compare.pass.cpp26
-rw-r--r--libcxx/test/containers/associative/map/map.cons/initializer_list_compare_alloc.pass.cpp28
-rw-r--r--libcxx/test/containers/associative/map/map.cons/iter_iter.pass.cpp27
-rw-r--r--libcxx/test/containers/associative/map/map.cons/iter_iter_comp.pass.cpp28
-rw-r--r--libcxx/test/containers/associative/map/map.cons/iter_iter_comp_alloc.pass.cpp30
-rw-r--r--libcxx/test/containers/associative/map/map.cons/move.pass.cpp48
-rw-r--r--libcxx/test/containers/associative/map/map.cons/move_alloc.pass.cpp42
-rw-r--r--libcxx/test/containers/associative/map/map.cons/move_assign.pass.cpp43
-rw-r--r--libcxx/test/containers/associative/map/map.modifiers/clear.pass.cpp23
-rw-r--r--libcxx/test/containers/associative/map/map.modifiers/emplace.pass.cpp67
-rw-r--r--libcxx/test/containers/associative/map/map.modifiers/emplace_hint.pass.cpp62
-rw-r--r--libcxx/test/containers/associative/map/map.modifiers/erase_iter.pass.cpp110
-rw-r--r--libcxx/test/containers/associative/map/map.modifiers/erase_iter_iter.pass.cpp70
-rw-r--r--libcxx/test/containers/associative/map/map.modifiers/erase_key.pass.cpp129
-rw-r--r--libcxx/test/containers/associative/map/map.modifiers/insert_cv.pass.cpp36
-rw-r--r--libcxx/test/containers/associative/map/map.modifiers/insert_initializer_list.pass.cpp28
-rw-r--r--libcxx/test/containers/associative/map/map.modifiers/insert_iter_cv.pass.cpp32
-rw-r--r--libcxx/test/containers/associative/map/map.modifiers/insert_iter_iter.pass.cpp28
-rw-r--r--libcxx/test/containers/associative/map/map.modifiers/insert_iter_rv.pass.cpp32
-rw-r--r--libcxx/test/containers/associative/map/map.modifiers/insert_rv.pass.cpp35
-rw-r--r--libcxx/test/containers/associative/map/map.ops/count.pass.cpp43
-rw-r--r--libcxx/test/containers/associative/map/map.ops/equal_range.pass.cpp142
-rw-r--r--libcxx/test/containers/associative/map/map.ops/find.pass.cpp76
-rw-r--r--libcxx/test/containers/associative/map/map.ops/lower_bound.pass.cpp108
-rw-r--r--libcxx/test/containers/associative/map/map.ops/upper_bound.pass.cpp108
-rw-r--r--libcxx/test/containers/associative/map/map.special/member_swap.pass.cpp94
-rw-r--r--libcxx/test/containers/associative/map/map.special/non_member_swap.pass.cpp127
-rw-r--r--libcxx/test/containers/associative/map/types.pass.cpp19
-rw-r--r--libcxx/test/containers/associative/multimap/empty.pass.cpp15
-rw-r--r--libcxx/test/containers/associative/multimap/iterator.pass.cpp92
-rw-r--r--libcxx/test/containers/associative/multimap/max_size.pass.cpp11
-rw-r--r--libcxx/test/containers/associative/multimap/multimap.cons/alloc.pass.cpp13
-rw-r--r--libcxx/test/containers/associative/multimap/multimap.cons/assign_initializer_list.pass.cpp35
-rw-r--r--libcxx/test/containers/associative/multimap/multimap.cons/compare.pass.cpp12
-rw-r--r--libcxx/test/containers/associative/multimap/multimap.cons/compare_alloc.pass.cpp14
-rw-r--r--libcxx/test/containers/associative/multimap/multimap.cons/copy.pass.cpp28
-rw-r--r--libcxx/test/containers/associative/multimap/multimap.cons/copy_alloc.pass.cpp30
-rw-r--r--libcxx/test/containers/associative/multimap/multimap.cons/copy_assign.pass.cpp29
-rw-r--r--libcxx/test/containers/associative/multimap/multimap.cons/default.pass.cpp11
-rw-r--r--libcxx/test/containers/associative/multimap/multimap.cons/initializer_list.pass.cpp34
-rw-r--r--libcxx/test/containers/associative/multimap/multimap.cons/initializer_list_compare.pass.cpp37
-rw-r--r--libcxx/test/containers/associative/multimap/multimap.cons/initializer_list_compare_alloc.pass.cpp39
-rw-r--r--libcxx/test/containers/associative/multimap/multimap.cons/iter_iter.pass.cpp33
-rw-r--r--libcxx/test/containers/associative/multimap/multimap.cons/iter_iter_comp.pass.cpp34
-rw-r--r--libcxx/test/containers/associative/multimap/multimap.cons/iter_iter_comp_alloc.pass.cpp36
-rw-r--r--libcxx/test/containers/associative/multimap/multimap.cons/move.pass.cpp54
-rw-r--r--libcxx/test/containers/associative/multimap/multimap.cons/move_alloc.pass.cpp42
-rw-r--r--libcxx/test/containers/associative/multimap/multimap.cons/move_assign.pass.cpp43
-rw-r--r--libcxx/test/containers/associative/multimap/multimap.modifiers/clear.pass.cpp23
-rw-r--r--libcxx/test/containers/associative/multimap/multimap.modifiers/emplace.pass.cpp60
-rw-r--r--libcxx/test/containers/associative/multimap/multimap.modifiers/emplace_hint.pass.cpp62
-rw-r--r--libcxx/test/containers/associative/multimap/multimap.modifiers/erase_iter.pass.cpp131
-rw-r--r--libcxx/test/containers/associative/multimap/multimap.modifiers/erase_iter_iter.pass.cpp70
-rw-r--r--libcxx/test/containers/associative/multimap/multimap.modifiers/erase_key.pass.cpp67
-rw-r--r--libcxx/test/containers/associative/multimap/multimap.modifiers/insert_cv.pass.cpp32
-rw-r--r--libcxx/test/containers/associative/multimap/multimap.modifiers/insert_initializer_list.pass.cpp38
-rw-r--r--libcxx/test/containers/associative/multimap/multimap.modifiers/insert_iter_cv.pass.cpp32
-rw-r--r--libcxx/test/containers/associative/multimap/multimap.modifiers/insert_iter_iter.pass.cpp40
-rw-r--r--libcxx/test/containers/associative/multimap/multimap.modifiers/insert_iter_rv.pass.cpp32
-rw-r--r--libcxx/test/containers/associative/multimap/multimap.modifiers/insert_rv.pass.cpp31
-rw-r--r--libcxx/test/containers/associative/multimap/multimap.ops/count.pass.cpp39
-rw-r--r--libcxx/test/containers/associative/multimap/multimap.ops/equal_range.pass.cpp83
-rw-r--r--libcxx/test/containers/associative/multimap/multimap.ops/find.pass.cpp65
-rw-r--r--libcxx/test/containers/associative/multimap/multimap.ops/lower_bound.pass.cpp69
-rw-r--r--libcxx/test/containers/associative/multimap/multimap.ops/upper_bound.pass.cpp69
-rw-r--r--libcxx/test/containers/associative/multimap/multimap.special/member_swap.pass.cpp93
-rw-r--r--libcxx/test/containers/associative/multimap/multimap.special/non_member_swap.pass.cpp126
-rw-r--r--libcxx/test/containers/associative/multimap/size.pass.cpp23
-rw-r--r--libcxx/test/containers/associative/multimap/types.pass.cpp19
-rw-r--r--libcxx/test/containers/associative/multiset/clear.pass.cpp23
-rw-r--r--libcxx/test/containers/associative/multiset/count.pass.cpp40
-rw-r--r--libcxx/test/containers/associative/multiset/emplace.pass.cpp12
-rw-r--r--libcxx/test/containers/associative/multiset/emplace_hint.pass.cpp12
-rw-r--r--libcxx/test/containers/associative/multiset/empty.pass.cpp15
-rw-r--r--libcxx/test/containers/associative/multiset/equal_range.pass.cpp84
-rw-r--r--libcxx/test/containers/associative/multiset/erase_iter.pass.cpp82
-rw-r--r--libcxx/test/containers/associative/multiset/erase_iter_iter.pass.cpp62
-rw-r--r--libcxx/test/containers/associative/multiset/erase_key.pass.cpp56
-rw-r--r--libcxx/test/containers/associative/multiset/find.pass.cpp200
-rw-r--r--libcxx/test/containers/associative/multiset/insert_cv.pass.cpp28
-rw-r--r--libcxx/test/containers/associative/multiset/insert_initializer_list.pass.cpp23
-rw-r--r--libcxx/test/containers/associative/multiset/insert_iter_cv.pass.cpp28
-rw-r--r--libcxx/test/containers/associative/multiset/insert_iter_iter.pass.cpp32
-rw-r--r--libcxx/test/containers/associative/multiset/insert_iter_rv.pass.cpp27
-rw-r--r--libcxx/test/containers/associative/multiset/insert_rv.pass.cpp27
-rw-r--r--libcxx/test/containers/associative/multiset/iterator.pass.cpp86
-rw-r--r--libcxx/test/containers/associative/multiset/lower_bound.pass.cpp182
-rw-r--r--libcxx/test/containers/associative/multiset/max_size.pass.cpp11
-rw-r--r--libcxx/test/containers/associative/multiset/multiset.cons/assign_initializer_list.pass.cpp21
-rw-r--r--libcxx/test/containers/associative/multiset/multiset.cons/default.pass.cpp11
-rw-r--r--libcxx/test/containers/associative/multiset/multiset.cons/initializer_list.pass.cpp20
-rw-r--r--libcxx/test/containers/associative/multiset/multiset.cons/iter_iter.pass.cpp33
-rw-r--r--libcxx/test/containers/associative/multiset/multiset.cons/move.pass.cpp40
-rw-r--r--libcxx/test/containers/associative/multiset/multiset.cons/move_assign.pass.cpp42
-rw-r--r--libcxx/test/containers/associative/multiset/multiset.special/member_swap.pass.cpp94
-rw-r--r--libcxx/test/containers/associative/multiset/size.pass.cpp23
-rw-r--r--libcxx/test/containers/associative/multiset/types.pass.cpp19
-rw-r--r--libcxx/test/containers/associative/multiset/upper_bound.pass.cpp70
-rw-r--r--libcxx/test/containers/associative/set/clear.pass.cpp23
-rw-r--r--libcxx/test/containers/associative/set/count.pass.cpp43
-rw-r--r--libcxx/test/containers/associative/set/emplace.pass.cpp13
-rw-r--r--libcxx/test/containers/associative/set/emplace_hint.pass.cpp12
-rw-r--r--libcxx/test/containers/associative/set/empty.pass.cpp15
-rw-r--r--libcxx/test/containers/associative/set/equal_range.pass.cpp74
-rw-r--r--libcxx/test/containers/associative/set/erase_iter.pass.cpp82
-rw-r--r--libcxx/test/containers/associative/set/erase_iter_iter.pass.cpp62
-rw-r--r--libcxx/test/containers/associative/set/erase_key.pass.cpp93
-rw-r--r--libcxx/test/containers/associative/set/find.pass.cpp76
-rw-r--r--libcxx/test/containers/associative/set/insert_cv.pass.cpp32
-rw-r--r--libcxx/test/containers/associative/set/insert_initializer_list.pass.cpp23
-rw-r--r--libcxx/test/containers/associative/set/insert_iter_cv.pass.cpp28
-rw-r--r--libcxx/test/containers/associative/set/insert_iter_iter.pass.cpp26
-rw-r--r--libcxx/test/containers/associative/set/insert_iter_rv.pass.cpp27
-rw-r--r--libcxx/test/containers/associative/set/insert_rv.pass.cpp31
-rw-r--r--libcxx/test/containers/associative/set/iterator.pass.cpp84
-rw-r--r--libcxx/test/containers/associative/set/lower_bound.pass.cpp108
-rw-r--r--libcxx/test/containers/associative/set/max_size.pass.cpp11
-rw-r--r--libcxx/test/containers/associative/set/set.cons/assign_initializer_list.pass.cpp21
-rw-r--r--libcxx/test/containers/associative/set/set.cons/default.pass.cpp11
-rw-r--r--libcxx/test/containers/associative/set/set.cons/initializer_list.pass.cpp20
-rw-r--r--libcxx/test/containers/associative/set/set.cons/iter_iter.pass.cpp27
-rw-r--r--libcxx/test/containers/associative/set/set.cons/move.pass.cpp34
-rw-r--r--libcxx/test/containers/associative/set/set.cons/move_assign.pass.cpp42
-rw-r--r--libcxx/test/containers/associative/set/set.special/member_swap.pass.cpp94
-rw-r--r--libcxx/test/containers/associative/set/size.pass.cpp23
-rw-r--r--libcxx/test/containers/associative/set/types.pass.cpp19
-rw-r--r--libcxx/test/containers/associative/set/upper_bound.pass.cpp108
-rw-r--r--libcxx/test/containers/min_allocator.h268
145 files changed, 6813 insertions, 123 deletions
diff --git a/libcxx/test/containers/associative/map/map.access/at.pass.cpp b/libcxx/test/containers/associative/map/map.access/at.pass.cpp
index 09f70b0f88d..6c001a34428 100644
--- a/libcxx/test/containers/associative/map/map.access/at.pass.cpp
+++ b/libcxx/test/containers/associative/map/map.access/at.pass.cpp
@@ -17,6 +17,8 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
{
@@ -83,4 +85,70 @@ int main()
assert(m.at(8) == 8.5);
assert(m.size() == 7);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] =
+ {
+ V(1, 1.5),
+ V(2, 2.5),
+ V(3, 3.5),
+ V(4, 4.5),
+ V(5, 5.5),
+ V(7, 7.5),
+ V(8, 8.5),
+ };
+ std::map<int, double, std::less<int>, min_allocator<V>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ assert(m.size() == 7);
+ assert(m.at(1) == 1.5);
+ m.at(1) = -1.5;
+ assert(m.at(1) == -1.5);
+ assert(m.at(2) == 2.5);
+ assert(m.at(3) == 3.5);
+ assert(m.at(4) == 4.5);
+ assert(m.at(5) == 5.5);
+ try
+ {
+ m.at(6);
+ assert(false);
+ }
+ catch (std::out_of_range&)
+ {
+ }
+ assert(m.at(7) == 7.5);
+ assert(m.at(8) == 8.5);
+ assert(m.size() == 7);
+ }
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] =
+ {
+ V(1, 1.5),
+ V(2, 2.5),
+ V(3, 3.5),
+ V(4, 4.5),
+ V(5, 5.5),
+ V(7, 7.5),
+ V(8, 8.5),
+ };
+ const std::map<int, double, std::less<int>, min_allocator<V>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ assert(m.size() == 7);
+ assert(m.at(1) == 1.5);
+ assert(m.at(2) == 2.5);
+ assert(m.at(3) == 3.5);
+ assert(m.at(4) == 4.5);
+ assert(m.at(5) == 5.5);
+ try
+ {
+ m.at(6);
+ assert(false);
+ }
+ catch (std::out_of_range&)
+ {
+ }
+ assert(m.at(7) == 7.5);
+ assert(m.at(8) == 8.5);
+ assert(m.size() == 7);
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/map/map.access/empty.pass.cpp b/libcxx/test/containers/associative/map/map.access/empty.pass.cpp
index b654117f7a7..2e542ac8c32 100644
--- a/libcxx/test/containers/associative/map/map.access/empty.pass.cpp
+++ b/libcxx/test/containers/associative/map/map.access/empty.pass.cpp
@@ -16,8 +16,11 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
+ {
typedef std::map<int, double> M;
M m;
assert(m.empty());
@@ -25,4 +28,16 @@ int main()
assert(!m.empty());
m.clear();
assert(m.empty());
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ M m;
+ assert(m.empty());
+ m.insert(M::value_type(1, 1.5));
+ assert(!m.empty());
+ m.clear();
+ assert(m.empty());
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/map/map.access/index_key.pass.cpp b/libcxx/test/containers/associative/map/map.access/index_key.pass.cpp
index fb82bbedf81..7579088784c 100644
--- a/libcxx/test/containers/associative/map/map.access/index_key.pass.cpp
+++ b/libcxx/test/containers/associative/map/map.access/index_key.pass.cpp
@@ -16,8 +16,11 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
+ {
typedef std::pair<const int, double> V;
V ar[] =
{
@@ -41,4 +44,33 @@ int main()
m[6] = 6.5;
assert(m[6] == 6.5);
assert(m.size() == 8);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] =
+ {
+ V(1, 1.5),
+ V(2, 2.5),
+ V(3, 3.5),
+ V(4, 4.5),
+ V(5, 5.5),
+ V(7, 7.5),
+ V(8, 8.5),
+ };
+ std::map<int, double, std::less<int>, min_allocator<V>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ assert(m.size() == 7);
+ assert(m[1] == 1.5);
+ assert(m.size() == 7);
+ const int i = 1;
+ m[i] = -1.5;
+ assert(m[1] == -1.5);
+ assert(m.size() == 7);
+ assert(m[6] == 0);
+ assert(m.size() == 8);
+ m[6] = 6.5;
+ assert(m[6] == 6.5);
+ assert(m.size() == 8);
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/map/map.access/index_rv_key.pass.cpp b/libcxx/test/containers/associative/map/map.access/index_rv_key.pass.cpp
index 4efe88c80d7..4c15f088fae 100644
--- a/libcxx/test/containers/associative/map/map.access/index_rv_key.pass.cpp
+++ b/libcxx/test/containers/associative/map/map.access/index_rv_key.pass.cpp
@@ -17,10 +17,12 @@
#include <cassert>
#include "../../../MoveOnly.h"
+#include "../../../min_allocator.h"
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {
typedef std::pair<MoveOnly, double> V;
std::map<MoveOnly, double> m;
assert(m.size() == 0);
@@ -34,5 +36,23 @@ int main()
m[6] = 6.5;
assert(m[6] == 6.5);
assert(m.size() == 2);
+ }
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<MoveOnly, double> V;
+ std::map<MoveOnly, double, std::less<MoveOnly>, min_allocator<V>> m;
+ assert(m.size() == 0);
+ assert(m[1] == 0.0);
+ assert(m.size() == 1);
+ m[1] = -1.5;
+ assert(m[1] == -1.5);
+ assert(m.size() == 1);
+ assert(m[6] == 0);
+ assert(m.size() == 2);
+ m[6] = 6.5;
+ assert(m[6] == 6.5);
+ assert(m.size() == 2);
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/map/map.access/iterator.pass.cpp b/libcxx/test/containers/associative/map/map.access/iterator.pass.cpp
index d8b2e1a58d5..048c074c296 100644
--- a/libcxx/test/containers/associative/map/map.access/iterator.pass.cpp
+++ b/libcxx/test/containers/associative/map/map.access/iterator.pass.cpp
@@ -29,6 +29,8 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
{
@@ -117,4 +119,92 @@ int main()
assert(i->second == 1);
}
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] =
+ {
+ V(1, 1),
+ V(1, 1.5),
+ V(1, 2),
+ V(2, 1),
+ V(2, 1.5),
+ V(2, 2),
+ V(3, 1),
+ V(3, 1.5),
+ V(3, 2),
+ V(4, 1),
+ V(4, 1.5),
+ V(4, 2),
+ V(5, 1),
+ V(5, 1.5),
+ V(5, 2),
+ V(6, 1),
+ V(6, 1.5),
+ V(6, 2),
+ V(7, 1),
+ V(7, 1.5),
+ V(7, 2),
+ V(8, 1),
+ V(8, 1.5),
+ V(8, 2)
+ };
+ std::map<int, double, std::less<int>, min_allocator<V>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ assert(std::distance(m.begin(), m.end()) == m.size());
+ assert(std::distance(m.rbegin(), m.rend()) == m.size());
+ std::map<int, double, std::less<int>, min_allocator<V>>::iterator i;
+ i = m.begin();
+ std::map<int, double, std::less<int>, min_allocator<V>>::const_iterator k = i;
+ assert(i == k);
+ for (int j = 1; j <= m.size(); ++j, ++i)
+ {
+ assert(i->first == j);
+ assert(i->second == 1);
+ i->second = 2.5;
+ assert(i->second == 2.5);
+ }
+ }
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] =
+ {
+ V(1, 1),
+ V(1, 1.5),
+ V(1, 2),
+ V(2, 1),
+ V(2, 1.5),
+ V(2, 2),
+ V(3, 1),
+ V(3, 1.5),
+ V(3, 2),
+ V(4, 1),
+ V(4, 1.5),
+ V(4, 2),
+ V(5, 1),
+ V(5, 1.5),
+ V(5, 2),
+ V(6, 1),
+ V(6, 1.5),
+ V(6, 2),
+ V(7, 1),
+ V(7, 1.5),
+ V(7, 2),
+ V(8, 1),
+ V(8, 1.5),
+ V(8, 2)
+ };
+ const std::map<int, double, std::less<int>, min_allocator<V>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ assert(std::distance(m.begin(), m.end()) == m.size());
+ assert(std::distance(m.cbegin(), m.cend()) == m.size());
+ assert(std::distance(m.rbegin(), m.rend()) == m.size());
+ assert(std::distance(m.crbegin(), m.crend()) == m.size());
+ std::map<int, double, std::less<int>, min_allocator<V>>::const_iterator i;
+ i = m.begin();
+ for (int j = 1; j <= m.size(); ++j, ++i)
+ {
+ assert(i->first == j);
+ assert(i->second == 1);
+ }
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/map/map.access/max_size.pass.cpp b/libcxx/test/containers/associative/map/map.access/max_size.pass.cpp
index e63587d4b43..6f86d0e9de8 100644
--- a/libcxx/test/containers/associative/map/map.access/max_size.pass.cpp
+++ b/libcxx/test/containers/associative/map/map.access/max_size.pass.cpp
@@ -16,9 +16,20 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
+ {
typedef std::map<int, double> M;
M m;
assert(m.max_size() != 0);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ M m;
+ assert(m.max_size() != 0);
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/map/map.access/size.pass.cpp b/libcxx/test/containers/associative/map/map.access/size.pass.cpp
index ab4d7c63c33..ab4b05baa5a 100644
--- a/libcxx/test/containers/associative/map/map.access/size.pass.cpp
+++ b/libcxx/test/containers/associative/map/map.access/size.pass.cpp
@@ -16,8 +16,11 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
+ {
typedef std::map<int, double> M;
M m;
assert(m.size() == 0);
@@ -33,4 +36,24 @@ int main()
assert(m.size() == 1);
m.erase(m.begin());
assert(m.size() == 0);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ M m;
+ assert(m.size() == 0);
+ m.insert(M::value_type(2, 1.5));
+ assert(m.size() == 1);
+ m.insert(M::value_type(1, 1.5));
+ assert(m.size() == 2);
+ m.insert(M::value_type(3, 1.5));
+ assert(m.size() == 3);
+ m.erase(m.begin());
+ assert(m.size() == 2);
+ m.erase(m.begin());
+ assert(m.size() == 1);
+ m.erase(m.begin());
+ assert(m.size() == 0);
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/map/map.cons/alloc.pass.cpp b/libcxx/test/containers/associative/map/map.cons/alloc.pass.cpp
index 1a77f60564c..95d71da664a 100644
--- a/libcxx/test/containers/associative/map/map.cons/alloc.pass.cpp
+++ b/libcxx/test/containers/associative/map/map.cons/alloc.pass.cpp
@@ -17,13 +17,26 @@
#include <cassert>
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
+ {
typedef std::less<int> C;
typedef test_allocator<std::pair<const int, double> > A;
std::map<int, double, C, A> m(A(5));
assert(m.empty());
assert(m.begin() == m.end());
assert(m.get_allocator() == A(5));
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::less<int> C;
+ typedef min_allocator<std::pair<const int, double> > A;
+ std::map<int, double, C, A> m(A{});
+ assert(m.empty());
+ assert(m.begin() == m.end());
+ assert(m.get_allocator() == A());
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/map/map.cons/assign_initializer_list.pass.cpp b/libcxx/test/containers/associative/map/map.cons/assign_initializer_list.pass.cpp
index 2fdf5b294af..a583f0d597f 100644
--- a/libcxx/test/containers/associative/map/map.cons/assign_initializer_list.pass.cpp
+++ b/libcxx/test/containers/associative/map/map.cons/assign_initializer_list.pass.cpp
@@ -16,9 +16,12 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ {
typedef std::pair<const int, double> V;
std::map<int, double> m =
{
@@ -41,5 +44,32 @@ int main()
assert(*m.begin() == V(1, 1));
assert(*next(m.begin()) == V(2, 1));
assert(*next(m.begin(), 2) == V(3, 1));
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<const int, double> V;
+ std::map<int, double, std::less<int>, min_allocator<V>> m =
+ {
+ {20, 1},
+ };
+ m =
+ {
+ {1, 1},
+ {1, 1.5},
+ {1, 2},
+ {2, 1},
+ {2, 1.5},
+ {2, 2},
+ {3, 1},
+ {3, 1.5},
+ {3, 2}
+ };
+ assert(m.size() == 3);
+ assert(distance(m.begin(), m.end()) == 3);
+ assert(*m.begin() == V(1, 1));
+ assert(*next(m.begin()) == V(2, 1));
+ assert(*next(m.begin(), 2) == V(3, 1));
+ }
+#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
diff --git a/libcxx/test/containers/associative/map/map.cons/compare.pass.cpp b/libcxx/test/containers/associative/map/map.cons/compare.pass.cpp
index 5648ff0fb66..2c4bb1a8cbc 100644
--- a/libcxx/test/containers/associative/map/map.cons/compare.pass.cpp
+++ b/libcxx/test/containers/associative/map/map.cons/compare.pass.cpp
@@ -17,12 +17,24 @@
#include <cassert>
#include "../../../test_compare.h"
+#include "../../../min_allocator.h"
int main()
{
+ {
typedef test_compare<std::less<int> > C;
std::map<int, double, C> m(C(3));
assert(m.empty());
assert(m.begin() == m.end());
assert(m.key_comp() == C(3));
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef test_compare<std::less<int> > C;
+ std::map<int, double, C, min_allocator<std::pair<const int, double>>> m(C(3));
+ assert(m.empty());
+ assert(m.begin() == m.end());
+ assert(m.key_comp() == C(3));
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/map/map.cons/compare_alloc.pass.cpp b/libcxx/test/containers/associative/map/map.cons/compare_alloc.pass.cpp
index 26efa0dabc8..670acffc458 100644
--- a/libcxx/test/containers/associative/map/map.cons/compare_alloc.pass.cpp
+++ b/libcxx/test/containers/associative/map/map.cons/compare_alloc.pass.cpp
@@ -18,9 +18,11 @@
#include "../../../test_compare.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
+ {
typedef test_compare<std::less<int> > C;
typedef test_allocator<std::pair<const int, double> > A;
std::map<int, double, C, A> m(C(4), A(5));
@@ -28,4 +30,16 @@ int main()
assert(m.begin() == m.end());
assert(m.key_comp() == C(4));
assert(m.get_allocator() == A(5));
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef test_compare<std::less<int> > C;
+ typedef min_allocator<std::pair<const int, double> > A;
+ std::map<int, double, C, A> m(C(4), A());
+ assert(m.empty());
+ assert(m.begin() == m.end());
+ assert(m.key_comp() == C(4));
+ assert(m.get_allocator() == A());
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/map/map.cons/copy.pass.cpp b/libcxx/test/containers/associative/map/map.cons/copy.pass.cpp
index 01c0d89d5e4..ce20d69d7c9 100644
--- a/libcxx/test/containers/associative/map/map.cons/copy.pass.cpp
+++ b/libcxx/test/containers/associative/map/map.cons/copy.pass.cpp
@@ -18,6 +18,7 @@
#include "../../../test_compare.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -91,4 +92,40 @@ int main()
assert(*next(mo.begin(), 2) == V(3, 1));
}
#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] =
+ {
+ V(1, 1),
+ V(1, 1.5),
+ V(1, 2),
+ V(2, 1),
+ V(2, 1.5),
+ V(2, 2),
+ V(3, 1),
+ V(3, 1.5),
+ V(3, 2),
+ };
+ typedef test_compare<std::less<int> > C;
+ typedef min_allocator<V> A;
+ std::map<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A());
+ std::map<int, double, C, A> m = mo;
+ assert(m.get_allocator() == A());
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 3);
+ assert(distance(m.begin(), m.end()) == 3);
+ assert(*m.begin() == V(1, 1));
+ assert(*next(m.begin()) == V(2, 1));
+ assert(*next(m.begin(), 2) == V(3, 1));
+
+ assert(mo.get_allocator() == A());
+ assert(mo.key_comp() == C(5));
+ assert(mo.size() == 3);
+ assert(distance(mo.begin(), mo.end()) == 3);
+ assert(*mo.begin() == V(1, 1));
+ assert(*next(mo.begin()) == V(2, 1));
+ assert(*next(mo.begin(), 2) == V(3, 1));
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/map/map.cons/copy_alloc.pass.cpp b/libcxx/test/containers/associative/map/map.cons/copy_alloc.pass.cpp
index 27b1c9710cc..849240408ab 100644
--- a/libcxx/test/containers/associative/map/map.cons/copy_alloc.pass.cpp
+++ b/libcxx/test/containers/associative/map/map.cons/copy_alloc.pass.cpp
@@ -18,9 +18,11 @@
#include "../../../test_compare.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
+ {
typedef std::pair<const int, double> V;
V ar[] =
{
@@ -53,4 +55,41 @@ int main()
assert(*mo.begin() == V(1, 1));
assert(*next(mo.begin()) == V(2, 1));
assert(*next(mo.begin(), 2) == V(3, 1));
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] =
+ {
+ V(1, 1),
+ V(1, 1.5),
+ V(1, 2),
+ V(2, 1),
+ V(2, 1.5),
+ V(2, 2),
+ V(3, 1),
+ V(3, 1.5),
+ V(3, 2),
+ };
+ typedef test_compare<std::less<int> > C;
+ typedef min_allocator<V> A;
+ std::map<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A());
+ std::map<int, double, C, A> m(mo, A());
+ assert(m.get_allocator() == A());
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 3);
+ assert(distance(m.begin(), m.end()) == 3);
+ assert(*m.begin() == V(1, 1));
+ assert(*next(m.begin()) == V(2, 1));
+ assert(*next(m.begin(), 2) == V(3, 1));
+
+ assert(mo.get_allocator() == A());
+ assert(mo.key_comp() == C(5));
+ assert(mo.size() == 3);
+ assert(distance(mo.begin(), mo.end()) == 3);
+ assert(*mo.begin() == V(1, 1));
+ assert(*next(mo.begin()) == V(2, 1));
+ assert(*next(mo.begin(), 2) == V(3, 1));
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/map/map.cons/copy_assign.pass.cpp b/libcxx/test/containers/associative/map/map.cons/copy_assign.pass.cpp
index 7422ec99a90..fefb35ce712 100644
--- a/libcxx/test/containers/associative/map/map.cons/copy_assign.pass.cpp
+++ b/libcxx/test/containers/associative/map/map.cons/copy_assign.pass.cpp
@@ -18,6 +18,7 @@
#include "../../../test_compare.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -91,4 +92,76 @@ int main()
assert(*next(mo.begin()) == V(2, 1));
assert(*next(mo.begin(), 2) == V(3, 1));
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] =
+ {
+ V(1, 1),
+ V(1, 1.5),
+ V(1, 2),
+ V(2, 1),
+ V(2, 1.5),
+ V(2, 2),
+ V(3, 1),
+ V(3, 1.5),
+ V(3, 2)
+ };
+ typedef test_compare<std::less<int> > C;
+ typedef min_allocator<V> A;
+ std::map<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A());
+ std::map<int, double, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0])/2, C(3), A());
+ m = mo;
+ assert(m.get_allocator() == A());
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 3);
+ assert(distance(m.begin(), m.end()) == 3);
+ assert(*m.begin() == V(1, 1));
+ assert(*next(m.begin()) == V(2, 1));
+ assert(*next(m.begin(), 2) == V(3, 1));
+
+ assert(mo.get_allocator() == A());
+ assert(mo.key_comp() == C(5));
+ assert(mo.size() == 3);
+ assert(distance(mo.begin(), mo.end()) == 3);
+ assert(*mo.begin() == V(1, 1));
+ assert(*next(mo.begin()) == V(2, 1));
+ assert(*next(mo.begin(), 2) == V(3, 1));
+ }
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] =
+ {
+ V(1, 1),
+ V(1, 1.5),
+ V(1, 2),
+ V(2, 1),
+ V(2, 1.5),
+ V(2, 2),
+ V(3, 1),
+ V(3, 1.5),
+ V(3, 2)
+ };
+ typedef test_compare<std::less<int> > C;
+ typedef min_allocator<V> A;
+ std::map<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A());
+ std::map<int, double, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0])/2, C(3), A());
+ m = mo;
+ assert(m.get_allocator() == A());
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 3);
+ assert(distance(m.begin(), m.end()) == 3);
+ assert(*m.begin() == V(1, 1));
+ assert(*next(m.begin()) == V(2, 1));
+ assert(*next(m.begin(), 2) == V(3, 1));
+
+ assert(mo.get_allocator() == A());
+ assert(mo.key_comp() == C(5));
+ assert(mo.size() == 3);
+ assert(distance(mo.begin(), mo.end()) == 3);
+ assert(*mo.begin() == V(1, 1));
+ assert(*next(mo.begin()) == V(2, 1));
+ assert(*next(mo.begin(), 2) == V(3, 1));
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/map/map.cons/default.pass.cpp b/libcxx/test/containers/associative/map/map.cons/default.pass.cpp
index 8b5397c3def..49fc223ffad 100644
--- a/libcxx/test/containers/associative/map/map.cons/default.pass.cpp
+++ b/libcxx/test/containers/associative/map/map.cons/default.pass.cpp
@@ -16,9 +16,20 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
+ {
std::map<int, double> m;
assert(m.empty());
assert(m.begin() == m.end());
+ }
+#if __cplusplus >= 201103L
+ {
+ std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> m;
+ assert(m.empty());
+ assert(m.begin() == m.end());
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/map/map.cons/default_recursive.pass.cpp b/libcxx/test/containers/associative/map/map.cons/default_recursive.pass.cpp
index 452746c87bb..8b393d3c91c 100644
--- a/libcxx/test/containers/associative/map/map.cons/default_recursive.pass.cpp
+++ b/libcxx/test/containers/associative/map/map.cons/default_recursive.pass.cpp
@@ -19,7 +19,7 @@
struct X
{
- std::multimap<int, X> m;
+ std::map<int, X> m;
};
#endif
diff --git a/libcxx/test/containers/associative/map/map.cons/initializer_list.pass.cpp b/libcxx/test/containers/associative/map/map.cons/initializer_list.pass.cpp
index 4acf2dcab51..63820beea13 100644
--- a/libcxx/test/containers/associative/map/map.cons/initializer_list.pass.cpp
+++ b/libcxx/test/containers/associative/map/map.cons/initializer_list.pass.cpp
@@ -16,9 +16,12 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ {
typedef std::pair<const int, double> V;
std::map<int, double> m =
{
@@ -37,5 +40,28 @@ int main()
assert(*m.begin() == V(1, 1));
assert(*next(m.begin()) == V(2, 1));
assert(*next(m.begin(), 2) == V(3, 1));
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<const int, double> V;
+ std::map<int, double, std::less<int>, min_allocator<V>> m =
+ {
+ {1, 1},
+ {1, 1.5},
+ {1, 2},
+ {2, 1},
+ {2, 1.5},
+ {2, 2},
+ {3, 1},
+ {3, 1.5},
+ {3, 2}
+ };
+ assert(m.size() == 3);
+ assert(distance(m.begin(), m.end()) == 3);
+ assert(*m.begin() == V(1, 1));
+ assert(*next(m.begin()) == V(2, 1));
+ assert(*next(m.begin(), 2) == V(3, 1));
+ }
+#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
diff --git a/libcxx/test/containers/associative/map/map.cons/initializer_list_compare.pass.cpp b/libcxx/test/containers/associative/map/map.cons/initializer_list_compare.pass.cpp
index 723a03f49d9..0c3bd23a635 100644
--- a/libcxx/test/containers/associative/map/map.cons/initializer_list_compare.pass.cpp
+++ b/libcxx/test/containers/associative/map/map.cons/initializer_list_compare.pass.cpp
@@ -16,10 +16,12 @@
#include <map>
#include <cassert>
#include "../../../test_compare.h"
+#include "../../../min_allocator.h"
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ {
typedef std::pair<const int, double> V;
typedef test_compare<std::less<int> > C;
std::map<int, double, C> m({
@@ -39,5 +41,29 @@ int main()
assert(*next(m.begin()) == V(2, 1));
assert(*next(m.begin(), 2) == V(3, 1));
assert(m.key_comp() == C(3));
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<const int, double> V;
+ typedef test_compare<std::less<int> > C;
+ std::map<int, double, C, min_allocator<std::pair<const int, double>>> m({
+ {1, 1},
+ {1, 1.5},
+ {1, 2},
+ {2, 1},
+ {2, 1.5},
+ {2, 2},
+ {3, 1},
+ {3, 1.5},
+ {3, 2}
+ }, C(3));
+ assert(m.size() == 3);
+ assert(distance(m.begin(), m.end()) == 3);
+ assert(*m.begin() == V(1, 1));
+ assert(*next(m.begin()) == V(2, 1));
+ assert(*next(m.begin(), 2) == V(3, 1));
+ assert(m.key_comp() == C(3));
+ }
+#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
diff --git a/libcxx/test/containers/associative/map/map.cons/initializer_list_compare_alloc.pass.cpp b/libcxx/test/containers/associative/map/map.cons/initializer_list_compare_alloc.pass.cpp
index f6300de20b9..14e0eb3d4f7 100644
--- a/libcxx/test/containers/associative/map/map.cons/initializer_list_compare_alloc.pass.cpp
+++ b/libcxx/test/containers/associative/map/map.cons/initializer_list_compare_alloc.pass.cpp
@@ -17,10 +17,12 @@
#include <cassert>
#include "../../../test_compare.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ {
typedef std::pair<const int, double> V;
typedef test_compare<std::less<int> > C;
typedef test_allocator<std::pair<const int, double> > A;
@@ -42,5 +44,31 @@ int main()
assert(*next(m.begin(), 2) == V(3, 1));
assert(m.key_comp() == C(3));
assert(m.get_allocator() == A(6));
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<const int, double> V;
+ typedef test_compare<std::less<int> > C;
+ typedef min_allocator<std::pair<const int, double> > A;
+ std::map<int, double, C, A> m({
+ {1, 1},
+ {1, 1.5},
+ {1, 2},
+ {2, 1},
+ {2, 1.5},
+ {2, 2},
+ {3, 1},
+ {3, 1.5},
+ {3, 2}
+ }, C(3), A());
+ assert(m.size() == 3);
+ assert(distance(m.begin(), m.end()) == 3);
+ assert(*m.begin() == V(1, 1));
+ assert(*next(m.begin()) == V(2, 1));
+ assert(*next(m.begin(), 2) == V(3, 1));
+ assert(m.key_comp() == C(3));
+ assert(m.get_allocator() == A());
+ }
+#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
diff --git a/libcxx/test/containers/associative/map/map.cons/iter_iter.pass.cpp b/libcxx/test/containers/associative/map/map.cons/iter_iter.pass.cpp
index 00d3d8a2766..d981ccff889 100644
--- a/libcxx/test/containers/associative/map/map.cons/iter_iter.pass.cpp
+++ b/libcxx/test/containers/associative/map/map.cons/iter_iter.pass.cpp
@@ -17,8 +17,11 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
+ {
typedef std::pair<const int, double> V;
V ar[] =
{
@@ -38,4 +41,28 @@ int main()
assert(*m.begin() == V(1, 1));
assert(*next(m.begin()) == V(2, 1));
assert(*next(m.begin(), 2) == V(3, 1));
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] =
+ {
+ V(1, 1),
+ V(1, 1.5),
+ V(1, 2),
+ V(2, 1),
+ V(2, 1.5),
+ V(2, 2),
+ V(3, 1),
+ V(3, 1.5),
+ V(3, 2),
+ };
+ std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ assert(m.size() == 3);
+ assert(distance(m.begin(), m.end()) == 3);
+ assert(*m.begin() == V(1, 1));
+ assert(*next(m.begin()) == V(2, 1));
+ assert(*next(m.begin(), 2) == V(3, 1));
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/map/map.cons/iter_iter_comp.pass.cpp b/libcxx/test/containers/associative/map/map.cons/iter_iter_comp.pass.cpp
index 6f851931ce9..0481de24ccd 100644
--- a/libcxx/test/containers/associative/map/map.cons/iter_iter_comp.pass.cpp
+++ b/libcxx/test/containers/associative/map/map.cons/iter_iter_comp.pass.cpp
@@ -18,9 +18,11 @@
#include <cassert>
#include "../../../test_compare.h"
+#include "../../../min_allocator.h"
int main()
{
+ {
typedef std::pair<const int, double> V;
V ar[] =
{
@@ -42,4 +44,30 @@ int main()
assert(*m.begin() == V(1, 1));
assert(*next(m.begin()) == V(2, 1));
assert(*next(m.begin(), 2) == V(3, 1));
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] =
+ {
+ V(1, 1),
+ V(1, 1.5),
+ V(1, 2),
+ V(2, 1),
+ V(2, 1.5),
+ V(2, 2),
+ V(3, 1),
+ V(3, 1.5),
+ V(3, 2),
+ };
+ typedef test_compare<std::less<int> > C;
+ std::map<int, double, C, min_allocator<std::pair<const int, double>>> m(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5));
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 3);
+ assert(distance(m.begin(), m.end()) == 3);
+ assert(*m.begin() == V(1, 1));
+ assert(*next(m.begin()) == V(2, 1));
+ assert(*next(m.begin(), 2) == V(3, 1));
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/map/map.cons/iter_iter_comp_alloc.pass.cpp b/libcxx/test/containers/associative/map/map.cons/iter_iter_comp_alloc.pass.cpp
index abee6d9f0b0..8fabdcc087d 100644
--- a/libcxx/test/containers/associative/map/map.cons/iter_iter_comp_alloc.pass.cpp
+++ b/libcxx/test/containers/associative/map/map.cons/iter_iter_comp_alloc.pass.cpp
@@ -20,9 +20,11 @@
#include "../../../test_compare.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
+ {
typedef std::pair<const int, double> V;
V ar[] =
{
@@ -46,4 +48,32 @@ int main()
assert(*m.begin() == V(1, 1));
assert(*next(m.begin()) == V(2, 1));
assert(*next(m.begin(), 2) == V(3, 1));
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] =
+ {
+ V(1, 1),
+ V(1, 1.5),
+ V(1, 2),
+ V(2, 1),
+ V(2, 1.5),
+ V(2, 2),
+ V(3, 1),
+ V(3, 1.5),
+ V(3, 2),
+ };
+ typedef test_compare<std::less<int> > C;
+ typedef min_allocator<V> A;
+ std::map<int, double, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A());
+ assert(m.get_allocator() == A());
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 3);
+ assert(distance(m.begin(), m.end()) == 3);
+ assert(*m.begin() == V(1, 1));
+ assert(*next(m.begin()) == V(2, 1));
+ assert(*next(m.begin(), 2) == V(3, 1));
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/map/map.cons/move.pass.cpp b/libcxx/test/containers/associative/map/map.cons/move.pass.cpp
index b86dd6e382c..323a26548e9 100644
--- a/libcxx/test/containers/associative/map/map.cons/move.pass.cpp
+++ b/libcxx/test/containers/associative/map/map.cons/move.pass.cpp
@@ -18,6 +18,7 @@
#include "../../../test_compare.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -68,5 +69,52 @@ int main()
assert(mo.size() == 0);
assert(distance(mo.begin(), mo.end()) == 0);
}
+#if __cplusplus >= 201103L
+ {
+ typedef test_compare<std::less<int> > C;
+ typedef min_allocator<V> A;
+ std::map<int, double, C, A> mo(C(5), A());
+ std::map<int, double, C, A> m = std::move(mo);
+ assert(m.get_allocator() == A());
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 0);
+ assert(distance(m.begin(), m.end()) == 0);
+
+ assert(mo.get_allocator() == A());
+ assert(mo.key_comp() == C(5));
+ assert(mo.size() == 0);
+ assert(distance(mo.begin(), mo.end()) == 0);
+ }
+ {
+ V ar[] =
+ {
+ V(1, 1),
+ V(1, 1.5),
+ V(1, 2),
+ V(2, 1),
+ V(2, 1.5),
+ V(2, 2),
+ V(3, 1),
+ V(3, 1.5),
+ V(3, 2),
+ };
+ typedef test_compare<std::less<int> > C;
+ typedef min_allocator<V> A;
+ std::map<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A());
+ std::map<int, double, C, A> m = std::move(mo);
+ assert(m.get_allocator() == A());
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 3);
+ assert(distance(m.begin(), m.end()) == 3);
+ assert(*m.begin() == V(1, 1));
+ assert(*next(m.begin()) == V(2, 1));
+ assert(*next(m.begin(), 2) == V(3, 1));
+
+ assert(mo.get_allocator() == A());
+ assert(mo.key_comp() == C(5));
+ assert(mo.size() == 0);
+ assert(distance(mo.begin(), mo.end()) == 0);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/libcxx/test/containers/associative/map/map.cons/move_alloc.pass.cpp b/libcxx/test/containers/associative/map/map.cons/move_alloc.pass.cpp
index c9675dbd645..2bb2c061258 100644
--- a/libcxx/test/containers/associative/map/map.cons/move_alloc.pass.cpp
+++ b/libcxx/test/containers/associative/map/map.cons/move_alloc.pass.cpp
@@ -19,6 +19,7 @@
#include "../../../MoveOnly.h"
#include "../../../test_compare.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -140,5 +141,46 @@ int main()
assert(m3.key_comp() == C(5));
assert(m1.empty());
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<MoveOnly, MoveOnly> V;
+ typedef std::pair<const MoveOnly, MoveOnly> VC;
+ typedef test_compare<std::less<MoveOnly> > C;
+ typedef min_allocator<VC> A;
+ typedef std::map<MoveOnly, MoveOnly, C, A> M;
+ typedef std::move_iterator<V*> I;
+ V a1[] =
+ {
+ V(1, 1),
+ V(1, 2),
+ V(1, 3),
+ V(2, 1),
+ V(2, 2),
+ V(2, 3),
+ V(3, 1),
+ V(3, 2),
+ V(3, 3)
+ };
+ M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A());
+ V a2[] =
+ {
+ V(1, 1),
+ V(1, 2),
+ V(1, 3),
+ V(2, 1),
+ V(2, 2),
+ V(2, 3),
+ V(3, 1),
+ V(3, 2),
+ V(3, 3)
+ };
+ M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A());
+ M m3(std::move(m1), A());
+ assert(m3 == m2);
+ assert(m3.get_allocator() == A());
+ assert(m3.key_comp() == C(5));
+ assert(m1.empty());
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/libcxx/test/containers/associative/map/map.cons/move_assign.pass.cpp b/libcxx/test/containers/associative/map/map.cons/move_assign.pass.cpp
index e8b9a88d97e..2e6ede7bec7 100644
--- a/libcxx/test/containers/associative/map/map.cons/move_assign.pass.cpp
+++ b/libcxx/test/containers/associative/map/map.cons/move_assign.pass.cpp
@@ -19,6 +19,7 @@
#include "../../../MoveOnly.h"
#include "../../../test_compare.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -143,5 +144,47 @@ int main()
assert(m3.key_comp() == C(5));
assert(m1.empty());
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<MoveOnly, MoveOnly> V;
+ typedef std::pair<const MoveOnly, MoveOnly> VC;
+ typedef test_compare<std::less<MoveOnly> > C;
+ typedef min_allocator<VC> A;
+ typedef std::map<MoveOnly, MoveOnly, C, A> M;
+ typedef std::move_iterator<V*> I;
+ V a1[] =
+ {
+ V(1, 1),
+ V(1, 2),
+ V(1, 3),
+ V(2, 1),
+ V(2, 2),
+ V(2, 3),
+ V(3, 1),
+ V(3, 2),
+ V(3, 3)
+ };
+ M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A());
+ V a2[] =
+ {
+ V(1, 1),
+ V(1, 2),
+ V(1, 3),
+ V(2, 1),
+ V(2, 2),
+ V(2, 3),
+ V(3, 1),
+ V(3, 2),
+ V(3, 3)
+ };
+ M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A());
+ M m3(C(3), A());
+ m3 = std::move(m1);
+ assert(m3 == m2);
+ assert(m3.get_allocator() == A());
+ assert(m3.key_comp() == C(5));
+ assert(m1.empty());
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/libcxx/test/containers/associative/map/map.modifiers/clear.pass.cpp b/libcxx/test/containers/associative/map/map.modifiers/clear.pass.cpp
index a181e632e88..77f50badfef 100644
--- a/libcxx/test/containers/associative/map/map.modifiers/clear.pass.cpp
+++ b/libcxx/test/containers/associative/map/map.modifiers/clear.pass.cpp
@@ -16,6 +16,8 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
{
@@ -37,4 +39,25 @@ int main()
m.clear();
assert(m.size() == 0);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ typedef std::pair<int, double> P;
+ P ar[] =
+ {
+ P(1, 1.5),
+ P(2, 2.5),
+ P(3, 3.5),
+ P(4, 4.5),
+ P(5, 5.5),
+ P(6, 6.5),
+ P(7, 7.5),
+ P(8, 8.5),
+ };
+ M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
+ assert(m.size() == 8);
+ m.clear();
+ assert(m.size() == 0);
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/map/map.modifiers/emplace.pass.cpp b/libcxx/test/containers/associative/map/map.modifiers/emplace.pass.cpp
index 4eb7e9f832a..3ade69db72e 100644
--- a/libcxx/test/containers/associative/map/map.modifiers/emplace.pass.cpp
+++ b/libcxx/test/containers/associative/map/map.modifiers/emplace.pass.cpp
@@ -20,6 +20,7 @@
#include "../../../Emplaceable.h"
#include "../../../DefaultOnly.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -88,5 +89,71 @@ int main()
assert(m.begin()->first == 2);
assert(m.begin()->second == 3.5);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::map<int, DefaultOnly, std::less<int>, min_allocator<std::pair<const int, DefaultOnly>>> M;
+ typedef std::pair<M::iterator, bool> R;
+ M m;
+ assert(DefaultOnly::count == 0);
+ R r = m.emplace();
+ assert(r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 1);
+ assert(m.begin()->first == 0);
+ assert(m.begin()->second == DefaultOnly());
+ assert(DefaultOnly::count == 1);
+ r = m.emplace(1);
+ assert(r.second);
+ assert(r.first == next(m.begin()));
+ assert(m.size() == 2);
+ assert(next(m.begin())->first == 1);
+ assert(next(m.begin())->second == DefaultOnly());
+ assert(DefaultOnly::count == 2);
+ r = m.emplace(1);
+ assert(!r.second);
+ assert(r.first == next(m.begin()));
+ assert(m.size() == 2);
+ assert(next(m.begin())->first == 1);
+ assert(next(m.begin())->second == DefaultOnly());
+ assert(DefaultOnly::count == 2);
+ }
+ assert(DefaultOnly::count == 0);
+ {
+ typedef std::map<int, Emplaceable, std::less<int>, min_allocator<std::pair<const int, Emplaceable>>> M;
+ typedef std::pair<M::iterator, bool> R;
+ M m;
+ R r = m.emplace(2);
+ assert(r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 1);
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == Emplaceable());
+ r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1),
+ std::forward_as_tuple(2, 3.5));
+ assert(r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 2);
+ assert(m.begin()->first == 1);
+ assert(m.begin()->second == Emplaceable(2, 3.5));
+ r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1),
+ std::forward_as_tuple(2, 3.5));
+ assert(!r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 2);
+ assert(m.begin()->first == 1);
+ assert(m.begin()->second == Emplaceable(2, 3.5));
+ }
+ {
+ typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ typedef std::pair<M::iterator, bool> R;
+ M m;
+ R r = m.emplace(M::value_type(2, 3.5));
+ assert(r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 1);
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == 3.5);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/libcxx/test/containers/associative/map/map.modifiers/emplace_hint.pass.cpp b/libcxx/test/containers/associative/map/map.modifiers/emplace_hint.pass.cpp
index 2bc225e28a7..e1eb586d487 100644
--- a/libcxx/test/containers/associative/map/map.modifiers/emplace_hint.pass.cpp
+++ b/libcxx/test/containers/associative/map/map.modifiers/emplace_hint.pass.cpp
@@ -19,6 +19,7 @@
#include "../../../Emplaceable.h"
#include "../../../DefaultOnly.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -82,5 +83,66 @@ int main()
assert(m.begin()->first == 2);
assert(m.begin()->second == 3.5);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::map<int, DefaultOnly, std::less<int>, min_allocator<std::pair<const int, DefaultOnly>>> M;
+ typedef M::iterator R;
+ M m;
+ assert(DefaultOnly::count == 0);
+ R r = m.emplace_hint(m.end());
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(m.begin()->first == 0);
+ assert(m.begin()->second == DefaultOnly());
+ assert(DefaultOnly::count == 1);
+ r = m.emplace_hint(m.end(), 1);
+ assert(r == next(m.begin()));
+ assert(m.size() == 2);
+ assert(next(m.begin())->first == 1);
+ assert(next(m.begin())->second == DefaultOnly());
+ assert(DefaultOnly::count == 2);
+ r = m.emplace_hint(m.end(), 1);
+ assert(r == next(m.begin()));
+ assert(m.size() == 2);
+ assert(next(m.begin())->first == 1);
+ assert(next(m.begin())->second == DefaultOnly());
+ assert(DefaultOnly::count == 2);
+ }
+ assert(DefaultOnly::count == 0);
+ {
+ typedef std::map<int, Emplaceable, std::less<int>, min_allocator<std::pair<const int, Emplaceable>>> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.emplace_hint(m.end(), 2);
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == Emplaceable());
+ r = m.emplace_hint(m.end(), std::piecewise_construct,
+ std::forward_as_tuple(1),
+ std::forward_as_tuple(2, 3.5));
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(m.begin()->first == 1);
+ assert(m.begin()->second == Emplaceable(2, 3.5));
+ r = m.emplace_hint(m.end(), std::piecewise_construct,
+ std::forward_as_tuple(1),
+ std::forward_as_tuple(2, 3.5));
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(m.begin()->first == 1);
+ assert(m.begin()->second == Emplaceable(2, 3.5));
+ }
+ {
+ typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.emplace_hint(m.end(), M::value_type(2, 3.5));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == 3.5);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/libcxx/test/containers/associative/map/map.modifiers/erase_iter.pass.cpp b/libcxx/test/containers/associative/map/map.modifiers/erase_iter.pass.cpp
index caf16472e29..086096b7c8b 100644
--- a/libcxx/test/containers/associative/map/map.modifiers/erase_iter.pass.cpp
+++ b/libcxx/test/containers/associative/map/map.modifiers/erase_iter.pass.cpp
@@ -16,6 +16,8 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
{
@@ -124,4 +126,112 @@ int main()
assert(i == m.begin());
assert(i == m.end());
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ typedef std::pair<int, double> P;
+ typedef M::iterator I;
+ P ar[] =
+ {
+ P(1, 1.5),
+ P(2, 2.5),
+ P(3, 3.5),
+ P(4, 4.5),
+ P(5, 5.5),
+ P(6, 6.5),
+ P(7, 7.5),
+ P(8, 8.5),
+ };
+ M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
+ assert(m.size() == 8);
+ I i = m.erase(next(m.cbegin(), 3));
+ assert(m.size() == 7);
+ assert(i == next(m.begin(), 3));
+ assert(m.begin()->first == 1);
+ assert(m.begin()->second == 1.5);
+ assert(next(m.begin())->first == 2);
+ assert(next(m.begin())->second == 2.5);
+ assert(next(m.begin(), 2)->first == 3);
+ assert(next(m.begin(), 2)->second == 3.5);
+ assert(next(m.begin(), 3)->first == 5);
+ assert(next(m.begin(), 3)->second == 5.5);
+ assert(next(m.begin(), 4)->first == 6);
+ assert(next(m.begin(), 4)->second == 6.5);
+ assert(next(m.begin(), 5)->first == 7);
+ assert(next(m.begin(), 5)->second == 7.5);
+ assert(next(m.begin(), 6)->first == 8);
+ assert(next(m.begin(), 6)->second == 8.5);
+
+ i = m.erase(next(m.cbegin(), 0));
+ assert(m.size() == 6);
+ assert(i == m.begin());
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == 2.5);
+ assert(next(m.begin())->first == 3);
+ assert(next(m.begin())->second == 3.5);
+ assert(next(m.begin(), 2)->first == 5);
+ assert(next(m.begin(), 2)->second == 5.5);
+ assert(next(m.begin(), 3)->first == 6);
+ assert(next(m.begin(), 3)->second == 6.5);
+ assert(next(m.begin(), 4)->first == 7);
+ assert(next(m.begin(), 4)->second == 7.5);
+ assert(next(m.begin(), 5)->first == 8);
+ assert(next(m.begin(), 5)->second == 8.5);
+
+ i = m.erase(next(m.cbegin(), 5));
+ assert(m.size() == 5);
+ assert(i == m.end());
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == 2.5);
+ assert(next(m.begin())->first == 3);
+ assert(next(m.begin())->second == 3.5);
+ assert(next(m.begin(), 2)->first == 5);
+ assert(next(m.begin(), 2)->second == 5.5);
+ assert(next(m.begin(), 3)->first == 6);
+ assert(next(m.begin(), 3)->second == 6.5);
+ assert(next(m.begin(), 4)->first == 7);
+ assert(next(m.begin(), 4)->second == 7.5);
+
+ i = m.erase(next(m.cbegin(), 1));
+ assert(m.size() == 4);
+ assert(i == next(m.begin()));
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == 2.5);
+ assert(next(m.begin())->first == 5);
+ assert(next(m.begin())->second == 5.5);
+ assert(next(m.begin(), 2)->first == 6);
+ assert(next(m.begin(), 2)->second == 6.5);
+ assert(next(m.begin(), 3)->first == 7);
+ assert(next(m.begin(), 3)->second == 7.5);
+
+ i = m.erase(next(m.cbegin(), 2));
+ assert(m.size() == 3);
+ assert(i == next(m.begin(), 2));
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == 2.5);
+ assert(next(m.begin())->first == 5);
+ assert(next(m.begin())->second == 5.5);
+ assert(next(m.begin(), 2)->first == 7);
+ assert(next(m.begin(), 2)->second == 7.5);
+
+ i = m.erase(next(m.cbegin(), 2));
+ assert(m.size() == 2);
+ assert(i == next(m.begin(), 2));
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == 2.5);
+ assert(next(m.begin())->first == 5);
+ assert(next(m.begin())->second == 5.5);
+
+ i = m.erase(next(m.cbegin(), 0));
+ assert(m.size() == 1);
+ assert(i == next(m.begin(), 0));
+ assert(m.begin()->first == 5);
+ assert(m.begin()->second == 5.5);
+
+ i = m.erase(m.cbegin());
+ assert(m.size() == 0);
+ assert(i == m.begin());
+ assert(i == m.end());
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/map/map.modifiers/erase_iter_iter.pass.cpp b/libcxx/test/containers/associative/map/map.modifiers/erase_iter_iter.pass.cpp
index b595d8a0736..6589ace8ff1 100644
--- a/libcxx/test/containers/associative/map/map.modifiers/erase_iter_iter.pass.cpp
+++ b/libcxx/test/containers/associative/map/map.modifiers/erase_iter_iter.pass.cpp
@@ -16,6 +16,8 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
{
@@ -84,4 +86,72 @@ int main()
assert(i == m.begin());
assert(i == m.end());
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ typedef std::pair<int, double> P;
+ typedef M::iterator I;
+ P ar[] =
+ {
+ P(1, 1.5),
+ P(2, 2.5),
+ P(3, 3.5),
+ P(4, 4.5),
+ P(5, 5.5),
+ P(6, 6.5),
+ P(7, 7.5),
+ P(8, 8.5),
+ };
+ M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
+ assert(m.size() == 8);
+ I i = m.erase(m.cbegin(), m.cbegin());
+ assert(m.size() == 8);
+ assert(i == m.begin());
+ assert(m.begin()->first == 1);
+ assert(m.begin()->second == 1.5);
+ assert(next(m.begin())->first == 2);
+ assert(next(m.begin())->second == 2.5);
+ assert(next(m.begin(), 2)->first == 3);
+ assert(next(m.begin(), 2)->second == 3.5);
+ assert(next(m.begin(), 3)->first == 4);
+ assert(next(m.begin(), 3)->second == 4.5);
+ assert(next(m.begin(), 4)->first == 5);
+ assert(next(m.begin(), 4)->second == 5.5);
+ assert(next(m.begin(), 5)->first == 6);
+ assert(next(m.begin(), 5)->second == 6.5);
+ assert(next(m.begin(), 6)->first == 7);
+ assert(next(m.begin(), 6)->second == 7.5);
+ assert(next(m.begin(), 7)->first == 8);
+ assert(next(m.begin(), 7)->second == 8.5);
+
+ i = m.erase(m.cbegin(), next(m.cbegin(), 2));
+ assert(m.size() == 6);
+ assert(i == m.begin());
+ assert(next(m.begin(), 0)->first == 3);
+ assert(next(m.begin(), 0)->second == 3.5);
+ assert(next(m.begin(), 1)->first == 4);
+ assert(next(m.begin(), 1)->second == 4.5);
+ assert(next(m.begin(), 2)->first == 5);
+ assert(next(m.begin(), 2)->second == 5.5);
+ assert(next(m.begin(), 3)->first == 6);
+ assert(next(m.begin(), 3)->second == 6.5);
+ assert(next(m.begin(), 4)->first == 7);
+ assert(next(m.begin(), 4)->second == 7.5);
+ assert(next(m.begin(), 5)->first == 8);
+ assert(next(m.begin(), 5)->second == 8.5);
+
+ i = m.erase(next(m.cbegin(), 2), next(m.cbegin(), 6));
+ assert(m.size() == 2);
+ assert(i == next(m.begin(), 2));
+ assert(next(m.begin(), 0)->first == 3);
+ assert(next(m.begin(), 0)->second == 3.5);
+ assert(next(m.begin(), 1)->first == 4);
+ assert(next(m.begin(), 1)->second == 4.5);
+
+ i = m.erase(m.cbegin(), m.cend());
+ assert(m.size() == 0);
+ assert(i == m.begin());
+ assert(i == m.end());
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/map/map.modifiers/erase_key.pass.cpp b/libcxx/test/containers/associative/map/map.modifiers/erase_key.pass.cpp
index e78a00ff74e..4a93173a704 100644
--- a/libcxx/test/containers/associative/map/map.modifiers/erase_key.pass.cpp
+++ b/libcxx/test/containers/associative/map/map.modifiers/erase_key.pass.cpp
@@ -16,6 +16,8 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
{
@@ -143,4 +145,131 @@ int main()
assert(m.size() == 0);
assert(s == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ typedef std::pair<int, double> P;
+ typedef M::size_type R;
+ P ar[] =
+ {
+ P(1, 1.5),
+ P(2, 2.5),
+ P(3, 3.5),
+ P(4, 4.5),
+ P(5, 5.5),
+ P(6, 6.5),
+ P(7, 7.5),
+ P(8, 8.5),
+ };
+ M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
+ assert(m.size() == 8);
+ R s = m.erase(9);
+ assert(s == 0);
+ assert(m.size() == 8);
+ assert(m.begin()->first == 1);
+ assert(m.begin()->second == 1.5);
+ assert(next(m.begin())->first == 2);
+ assert(next(m.begin())->second == 2.5);
+ assert(next(m.begin(), 2)->first == 3);
+ assert(next(m.begin(), 2)->second == 3.5);
+ assert(next(m.begin(), 3)->first == 4);
+ assert(next(m.begin(), 3)->second == 4.5);
+ assert(next(m.begin(), 4)->first == 5);
+ assert(next(m.begin(), 4)->second == 5.5);
+ assert(next(m.begin(), 5)->first == 6);
+ assert(next(m.begin(), 5)->second == 6.5);
+ assert(next(m.begin(), 6)->first == 7);
+ assert(next(m.begin(), 6)->second == 7.5);
+ assert(next(m.begin(), 7)->first == 8);
+ assert(next(m.begin(), 7)->second == 8.5);
+
+ s = m.erase(4);
+ assert(m.size() == 7);
+ assert(s == 1);
+ assert(m.begin()->first == 1);
+ assert(m.begin()->second == 1.5);
+ assert(next(m.begin())->first == 2);
+ assert(next(m.begin())->second == 2.5);
+ assert(next(m.begin(), 2)->first == 3);
+ assert(next(m.begin(), 2)->second == 3.5);
+ assert(next(m.begin(), 3)->first == 5);
+ assert(next(m.begin(), 3)->second == 5.5);
+ assert(next(m.begin(), 4)->first == 6);
+ assert(next(m.begin(), 4)->second == 6.5);
+ assert(next(m.begin(), 5)->first == 7);
+ assert(next(m.begin(), 5)->second == 7.5);
+ assert(next(m.begin(), 6)->first == 8);
+ assert(next(m.begin(), 6)->second == 8.5);
+
+ s = m.erase(1);
+ assert(m.size() == 6);
+ assert(s == 1);
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == 2.5);
+ assert(next(m.begin())->first == 3);
+ assert(next(m.begin())->second == 3.5);
+ assert(next(m.begin(), 2)->first == 5);
+ assert(next(m.begin(), 2)->second == 5.5);
+ assert(next(m.begin(), 3)->first == 6);
+ assert(next(m.begin(), 3)->second == 6.5);
+ assert(next(m.begin(), 4)->first == 7);
+ assert(next(m.begin(), 4)->second == 7.5);
+ assert(next(m.begin(), 5)->first == 8);
+ assert(next(m.begin(), 5)->second == 8.5);
+
+ s = m.erase(8);
+ assert(m.size() == 5);
+ assert(s == 1);
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == 2.5);
+ assert(next(m.begin())->first == 3);
+ assert(next(m.begin())->second == 3.5);
+ assert(next(m.begin(), 2)->first == 5);
+ assert(next(m.begin(), 2)->second == 5.5);
+ assert(next(m.begin(), 3)->first == 6);
+ assert(next(m.begin(), 3)->second == 6.5);
+ assert(next(m.begin(), 4)->first == 7);
+ assert(next(m.begin(), 4)->second == 7.5);
+
+ s = m.erase(3);
+ assert(m.size() == 4);
+ assert(s == 1);
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == 2.5);
+ assert(next(m.begin())->first == 5);
+ assert(next(m.begin())->second == 5.5);
+ assert(next(m.begin(), 2)->first == 6);
+ assert(next(m.begin(), 2)->second == 6.5);
+ assert(next(m.begin(), 3)->first == 7);
+ assert(next(m.begin(), 3)->second == 7.5);
+
+ s = m.erase(6);
+ assert(m.size() == 3);
+ assert(s == 1);
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == 2.5);
+ assert(next(m.begin())->first == 5);
+ assert(next(m.begin())->second == 5.5);
+ assert(next(m.begin(), 2)->first == 7);
+ assert(next(m.begin(), 2)->second == 7.5);
+
+ s = m.erase(7);
+ assert(m.size() == 2);
+ assert(s == 1);
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == 2.5);
+ assert(next(m.begin())->first == 5);
+ assert(next(m.begin())->second == 5.5);
+
+ s = m.erase(2);
+ assert(m.size() == 1);
+ assert(s == 1);
+ assert(m.begin()->first == 5);
+ assert(m.begin()->second == 5.5);
+
+ s = m.erase(5);
+ assert(m.size() == 0);
+ assert(s == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/map/map.modifiers/insert_cv.pass.cpp b/libcxx/test/containers/associative/map/map.modifiers/insert_cv.pass.cpp
index f405c4c3765..24d3f84ea30 100644
--- a/libcxx/test/containers/associative/map/map.modifiers/insert_cv.pass.cpp
+++ b/libcxx/test/containers/associative/map/map.modifiers/insert_cv.pass.cpp
@@ -16,6 +16,8 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
{
@@ -50,4 +52,38 @@ int main()
assert(r.first->first == 3);
assert(r.first->second == 3.5);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ typedef std::pair<M::iterator, bool> R;
+ M m;
+ R r = m.insert(M::value_type(2, 2.5));
+ assert(r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 1);
+ assert(r.first->first == 2);
+ assert(r.first->second == 2.5);
+
+ r = m.insert(M::value_type(1, 1.5));
+ assert(r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 2);
+ assert(r.first->first == 1);
+ assert(r.first->second == 1.5);
+
+ r = m.insert(M::value_type(3, 3.5));
+ assert(r.second);
+ assert(r.first == prev(m.end()));
+ assert(m.size() == 3);
+ assert(r.first->first == 3);
+ assert(r.first->second == 3.5);
+
+ r = m.insert(M::value_type(3, 3.5));
+ assert(!r.second);
+ assert(r.first == prev(m.end()));
+ assert(m.size() == 3);
+ assert(r.first->first == 3);
+ assert(r.first->second == 3.5);
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/map/map.modifiers/insert_initializer_list.pass.cpp b/libcxx/test/containers/associative/map/map.modifiers/insert_initializer_list.pass.cpp
index 66714d53eb5..bc7e760fad0 100644
--- a/libcxx/test/containers/associative/map/map.modifiers/insert_initializer_list.pass.cpp
+++ b/libcxx/test/containers/associative/map/map.modifiers/insert_initializer_list.pass.cpp
@@ -16,9 +16,12 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ {
typedef std::pair<const int, double> V;
std::map<int, double> m =
{
@@ -39,5 +42,30 @@ int main()
assert(*m.begin() == V(1, 1));
assert(*next(m.begin()) == V(2, 1));
assert(*next(m.begin(), 2) == V(3, 1));
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<const int, double> V;
+ std::map<int, double, std::less<int>, min_allocator<V>> m =
+ {
+ {1, 1},
+ {1, 1.5},
+ {1, 2},
+ {3, 1},
+ {3, 1.5},
+ {3, 2}
+ };
+ m.insert({
+ {2, 1},
+ {2, 1.5},
+ {2, 2},
+ });
+ assert(m.size() == 3);
+ assert(distance(m.begin(), m.end()) == 3);
+ assert(*m.begin() == V(1, 1));
+ assert(*next(m.begin()) == V(2, 1));
+ assert(*next(m.begin(), 2) == V(3, 1));
+ }
+#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
diff --git a/libcxx/test/containers/associative/map/map.modifiers/insert_iter_cv.pass.cpp b/libcxx/test/containers/associative/map/map.modifiers/insert_iter_cv.pass.cpp
index 105b4564dcd..43ca35a099f 100644
--- a/libcxx/test/containers/associative/map/map.modifiers/insert_iter_cv.pass.cpp
+++ b/libcxx/test/containers/associative/map/map.modifiers/insert_iter_cv.pass.cpp
@@ -16,6 +16,8 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
{
@@ -46,4 +48,34 @@ int main()
assert(r->first == 3);
assert(r->second == 3.5);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.insert(m.end(), M::value_type(2, 2.5));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(r->first == 2);
+ assert(r->second == 2.5);
+
+ r = m.insert(m.end(), M::value_type(1, 1.5));
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(r->first == 1);
+ assert(r->second == 1.5);
+
+ r = m.insert(m.end(), M::value_type(3, 3.5));
+ assert(r == prev(m.end()));
+ assert(m.size() == 3);
+ assert(r->first == 3);
+ assert(r->second == 3.5);
+
+ r = m.insert(m.end(), M::value_type(3, 3.5));
+ assert(r == prev(m.end()));
+ assert(m.size() == 3);
+ assert(r->first == 3);
+ assert(r->second == 3.5);
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/map/map.modifiers/insert_iter_iter.pass.cpp b/libcxx/test/containers/associative/map/map.modifiers/insert_iter_iter.pass.cpp
index 307e3e42f39..d1acdf2b826 100644
--- a/libcxx/test/containers/associative/map/map.modifiers/insert_iter_iter.pass.cpp
+++ b/libcxx/test/containers/associative/map/map.modifiers/insert_iter_iter.pass.cpp
@@ -18,6 +18,7 @@
#include <cassert>
#include "test_iterators.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -46,4 +47,31 @@ int main()
assert(next(m.begin(), 2)->first == 3);
assert(next(m.begin(), 2)->second == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ typedef std::pair<int, double> P;
+ P ar[] =
+ {
+ P(1, 1),
+ P(1, 1.5),
+ P(1, 2),
+ P(2, 1),
+ P(2, 1.5),
+ P(2, 2),
+ P(3, 1),
+ P(3, 1.5),
+ P(3, 2),
+ };
+ M m;
+ m.insert(input_iterator<P*>(ar), input_iterator<P*>(ar + sizeof(ar)/sizeof(ar[0])));
+ assert(m.size() == 3);
+ assert(m.begin()->first == 1);
+ assert(m.begin()->second == 1);
+ assert(next(m.begin())->first == 2);
+ assert(next(m.begin())->second == 1);
+ assert(next(m.begin(), 2)->first == 3);
+ assert(next(m.begin(), 2)->second == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/map/map.modifiers/insert_iter_rv.pass.cpp b/libcxx/test/containers/associative/map/map.modifiers/insert_iter_rv.pass.cpp
index 620c0159033..e84a82b609a 100644
--- a/libcxx/test/containers/associative/map/map.modifiers/insert_iter_rv.pass.cpp
+++ b/libcxx/test/containers/associative/map/map.modifiers/insert_iter_rv.pass.cpp
@@ -18,6 +18,7 @@
#include <cassert>
#include "../../../MoveOnly.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -51,5 +52,36 @@ int main()
assert(r->first == 3);
assert(r->second == 3);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::map<int, MoveOnly, std::less<int>, min_allocator<std::pair<const int, MoveOnly>>> M;
+ typedef std::pair<int, MoveOnly> P;
+ typedef M::iterator R;
+ M m;
+ R r = m.insert(m.end(), P(2, 2));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(r->first == 2);
+ assert(r->second == 2);
+
+ r = m.insert(m.end(), P(1, 1));
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(r->first == 1);
+ assert(r->second == 1);
+
+ r = m.insert(m.end(), P(3, 3));
+ assert(r == prev(m.end()));
+ assert(m.size() == 3);
+ assert(r->first == 3);
+ assert(r->second == 3);
+
+ r = m.insert(m.end(), P(3, 3));
+ assert(r == prev(m.end()));
+ assert(m.size() == 3);
+ assert(r->first == 3);
+ assert(r->second == 3);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/libcxx/test/containers/associative/map/map.modifiers/insert_rv.pass.cpp b/libcxx/test/containers/associative/map/map.modifiers/insert_rv.pass.cpp
index b95202b32f8..c5724c42980 100644
--- a/libcxx/test/containers/associative/map/map.modifiers/insert_rv.pass.cpp
+++ b/libcxx/test/containers/associative/map/map.modifiers/insert_rv.pass.cpp
@@ -18,6 +18,7 @@
#include <cassert>
#include "../../../MoveOnly.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -54,5 +55,39 @@ int main()
assert(r.first->first == 3);
assert(r.first->second == 3);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::map<int, MoveOnly, std::less<int>, min_allocator<std::pair<const int, MoveOnly>>> M;
+ typedef std::pair<M::iterator, bool> R;
+ M m;
+ R r = m.insert(M::value_type(2, 2));
+ assert(r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 1);
+ assert(r.first->first == 2);
+ assert(r.first->second == 2);
+
+ r = m.insert(M::value_type(1, 1));
+ assert(r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 2);
+ assert(r.first->first == 1);
+ assert(r.first->second == 1);
+
+ r = m.insert(M::value_type(3, 3));
+ assert(r.second);
+ assert(r.first == prev(m.end()));
+ assert(m.size() == 3);
+ assert(r.first->first == 3);
+ assert(r.first->second == 3);
+
+ r = m.insert(M::value_type(3, 3));
+ assert(!r.second);
+ assert(r.first == prev(m.end()));
+ assert(m.size() == 3);
+ assert(r.first->first == 3);
+ assert(r.first->second == 3);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/libcxx/test/containers/associative/map/map.ops/count.pass.cpp b/libcxx/test/containers/associative/map/map.ops/count.pass.cpp
index 427feff970b..70eadac3f8f 100644
--- a/libcxx/test/containers/associative/map/map.ops/count.pass.cpp
+++ b/libcxx/test/containers/associative/map/map.ops/count.pass.cpp
@@ -16,8 +16,11 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
+ {
typedef std::pair<const int, double> V;
typedef std::map<int, double> M;
{
@@ -53,4 +56,44 @@ int main()
r = m.count(4);
assert(r == 0);
}
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<const int, double> V;
+ typedef std::map<int, double, std::less<int>, min_allocator<V>> M;
+ {
+ typedef M::size_type R;
+ V ar[] =
+ {
+ V(5, 5),
+ V(6, 6),
+ V(7, 7),
+ V(8, 8),
+ V(9, 9),
+ V(10, 10),
+ V(11, 11),
+ V(12, 12)
+ };
+ const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.count(5);
+ assert(r == 1);
+ r = m.count(6);
+ assert(r == 1);
+ r = m.count(7);
+ assert(r == 1);
+ r = m.count(8);
+ assert(r == 1);
+ r = m.count(9);
+ assert(r == 1);
+ r = m.count(10);
+ assert(r == 1);
+ r = m.count(11);
+ assert(r == 1);
+ r = m.count(12);
+ assert(r == 1);
+ r = m.count(4);
+ assert(r == 0);
+ }
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/map/map.ops/equal_range.pass.cpp b/libcxx/test/containers/associative/map/map.ops/equal_range.pass.cpp
index 057ef6a4458..dc0d09760a9 100644
--- a/libcxx/test/containers/associative/map/map.ops/equal_range.pass.cpp
+++ b/libcxx/test/containers/associative/map/map.ops/equal_range.pass.cpp
@@ -17,8 +17,11 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
+ {
typedef std::pair<const int, double> V;
typedef std::map<int, double> M;
{
@@ -153,4 +156,143 @@ int main()
assert(r.first == next(m.begin(), 8));
assert(r.second == next(m.begin(), 8));
}
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<const int, double> V;
+ typedef std::map<int, double, std::less<int>, min_allocator<V>> M;
+ {
+ typedef std::pair<M::iterator, M::iterator> R;
+ V ar[] =
+ {
+ V(5, 5),
+ V(7, 6),
+ V(9, 7),
+ V(11, 8),
+ V(13, 9),
+ V(15, 10),
+ V(17, 11),
+ V(19, 12)
+ };
+ M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.equal_range(5);
+ assert(r.first == next(m.begin(), 0));
+ assert(r.second == next(m.begin(), 1));
+ r = m.equal_range(7);
+ assert(r.first == next(m.begin(), 1));
+ assert(r.second == next(m.begin(), 2));
+ r = m.equal_range(9);
+ assert(r.first == next(m.begin(), 2));
+ assert(r.second == next(m.begin(), 3));
+ r = m.equal_range(11);
+ assert(r.first == next(m.begin(), 3));
+ assert(r.second == next(m.begin(), 4));
+ r = m.equal_range(13);
+ assert(r.first == next(m.begin(), 4));
+ assert(r.second == next(m.begin(), 5));
+ r = m.equal_range(15);
+ assert(r.first == next(m.begin(), 5));
+ assert(r.second == next(m.begin(), 6));
+ r = m.equal_range(17);
+ assert(r.first == next(m.begin(), 6));
+ assert(r.second == next(m.begin(), 7));
+ r = m.equal_range(19);
+ assert(r.first == next(m.begin(), 7));
+ assert(r.second == next(m.begin(), 8));
+ r = m.equal_range(4);
+ assert(r.first == next(m.begin(), 0));
+ assert(r.second == next(m.begin(), 0));
+ r = m.equal_range(6);
+ assert(r.first == next(m.begin(), 1));
+ assert(r.second == next(m.begin(), 1));
+ r = m.equal_range(8);
+ assert(r.first == next(m.begin(), 2));
+ assert(r.second == next(m.begin(), 2));
+ r = m.equal_range(10);
+ assert(r.first == next(m.begin(), 3));
+ assert(r.second == next(m.begin(), 3));
+ r = m.equal_range(12);
+ assert(r.first == next(m.begin(), 4));
+ assert(r.second == next(m.begin(), 4));
+ r = m.equal_range(14);
+ assert(r.first == next(m.begin(), 5));
+ assert(r.second == next(m.begin(), 5));
+ r = m.equal_range(16);
+ assert(r.first == next(m.begin(), 6));
+ assert(r.second == next(m.begin(), 6));
+ r = m.equal_range(18);
+ assert(r.first == next(m.begin(), 7));
+ assert(r.second == next(m.begin(), 7));
+ r = m.equal_range(20);
+ assert(r.first == next(m.begin(), 8));
+ assert(r.second == next(m.begin(), 8));
+ }
+ {
+ typedef std::pair<M::const_iterator, M::const_iterator> R;
+ V ar[] =
+ {
+ V(5, 5),
+ V(7, 6),
+ V(9, 7),
+ V(11, 8),
+ V(13, 9),
+ V(15, 10),
+ V(17, 11),
+ V(19, 12)
+ };
+ const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.equal_range(5);
+ assert(r.first == next(m.begin(), 0));
+ assert(r.second == next(m.begin(), 1));
+ r = m.equal_range(7);
+ assert(r.first == next(m.begin(), 1));
+ assert(r.second == next(m.begin(), 2));
+ r = m.equal_range(9);
+ assert(r.first == next(m.begin(), 2));
+ assert(r.second == next(m.begin(), 3));
+ r = m.equal_range(11);
+ assert(r.first == next(m.begin(), 3));
+ assert(r.second == next(m.begin(), 4));
+ r = m.equal_range(13);
+ assert(r.first == next(m.begin(), 4));
+ assert(r.second == next(m.begin(), 5));
+ r = m.equal_range(15);
+ assert(r.first == next(m.begin(), 5));
+ assert(r.second == next(m.begin(), 6));
+ r = m.equal_range(17);
+ assert(r.first == next(m.begin(), 6));
+ assert(r.second == next(m.begin(), 7));
+ r = m.equal_range(19);
+ assert(r.first == next(m.begin(), 7));
+ assert(r.second == next(m.begin(), 8));
+ r = m.equal_range(4);
+ assert(r.first == next(m.begin(), 0));
+ assert(r.second == next(m.begin(), 0));
+ r = m.equal_range(6);
+ assert(r.first == next(m.begin(), 1));
+ assert(r.second == next(m.begin(), 1));
+ r = m.equal_range(8);
+ assert(r.first == next(m.begin(), 2));
+ assert(r.second == next(m.begin(), 2));
+ r = m.equal_range(10);
+ assert(r.first == next(m.begin(), 3));
+ assert(r.second == next(m.begin(), 3));
+ r = m.equal_range(12);
+ assert(r.first == next(m.begin(), 4));
+ assert(r.second == next(m.begin(), 4));
+ r = m.equal_range(14);
+ assert(r.first == next(m.begin(), 5));
+ assert(r.second == next(m.begin(), 5));
+ r = m.equal_range(16);
+ assert(r.first == next(m.begin(), 6));
+ assert(r.second == next(m.begin(), 6));
+ r = m.equal_range(18);
+ assert(r.first == next(m.begin(), 7));
+ assert(r.second == next(m.begin(), 7));
+ r = m.equal_range(20);
+ assert(r.first == next(m.begin(), 8));
+ assert(r.second == next(m.begin(), 8));
+ }
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/map/map.ops/find.pass.cpp b/libcxx/test/containers/associative/map/map.ops/find.pass.cpp
index afebf129474..a368dc5e7aa 100644
--- a/libcxx/test/containers/associative/map/map.ops/find.pass.cpp
+++ b/libcxx/test/containers/associative/map/map.ops/find.pass.cpp
@@ -17,8 +17,11 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
+ {
typedef std::pair<const int, double> V;
typedef std::map<int, double> M;
{
@@ -87,4 +90,77 @@ int main()
r = m.find(4);
assert(r == next(m.begin(), 8));
}
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<const int, double> V;
+ typedef std::map<int, double, std::less<int>, min_allocator<V>> M;
+ {
+ typedef M::iterator R;
+ V ar[] =
+ {
+ V(5, 5),
+ V(6, 6),
+ V(7, 7),
+ V(8, 8),
+ V(9, 9),
+ V(10, 10),
+ V(11, 11),
+ V(12, 12)
+ };
+ M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.find(5);
+ assert(r == m.begin());
+ r = m.find(6);
+ assert(r == next(m.begin()));
+ r = m.find(7);
+ assert(r == next(m.begin(), 2));
+ r = m.find(8);
+ assert(r == next(m.begin(), 3));
+ r = m.find(9);
+ assert(r == next(m.begin(), 4));
+ r = m.find(10);
+ assert(r == next(m.begin(), 5));
+ r = m.find(11);
+ assert(r == next(m.begin(), 6));
+ r = m.find(12);
+ assert(r == next(m.begin(), 7));
+ r = m.find(4);
+ assert(r == next(m.begin(), 8));
+ }
+ {
+ typedef M::const_iterator R;
+ V ar[] =
+ {
+ V(5, 5),
+ V(6, 6),
+ V(7, 7),
+ V(8, 8),
+ V(9, 9),
+ V(10, 10),
+ V(11, 11),
+ V(12, 12)
+ };
+ const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.find(5);
+ assert(r == m.begin());
+ r = m.find(6);
+ assert(r == next(m.begin()));
+ r = m.find(7);
+ assert(r == next(m.begin(), 2));
+ r = m.find(8);
+ assert(r == next(m.begin(), 3));
+ r = m.find(9);
+ assert(r == next(m.begin(), 4));
+ r = m.find(10);
+ assert(r == next(m.begin(), 5));
+ r = m.find(11);
+ assert(r == next(m.begin(), 6));
+ r = m.find(12);
+ assert(r == next(m.begin(), 7));
+ r = m.find(4);
+ assert(r == next(m.begin(), 8));
+ }
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/map/map.ops/lower_bound.pass.cpp b/libcxx/test/containers/associative/map/map.ops/lower_bound.pass.cpp
index f2f03cf37fe..a1b8e5b3c2e 100644
--- a/libcxx/test/containers/associative/map/map.ops/lower_bound.pass.cpp
+++ b/libcxx/test/containers/associative/map/map.ops/lower_bound.pass.cpp
@@ -17,8 +17,11 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
+ {
typedef std::pair<const int, double> V;
typedef std::map<int, double> M;
{
@@ -119,4 +122,109 @@ int main()
r = m.lower_bound(20);
assert(r == next(m.begin(), 8));
}
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<const int, double> V;
+ typedef std::map<int, double, std::less<int>, min_allocator<V>> M;
+ {
+ typedef M::iterator R;
+ V ar[] =
+ {
+ V(5, 5),
+ V(7, 6),
+ V(9, 7),
+ V(11, 8),
+ V(13, 9),
+ V(15, 10),
+ V(17, 11),
+ V(19, 12)
+ };
+ M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.lower_bound(5);
+ assert(r == m.begin());
+ r = m.lower_bound(7);
+ assert(r == next(m.begin()));
+ r = m.lower_bound(9);
+ assert(r == next(m.begin(), 2));
+ r = m.lower_bound(11);
+ assert(r == next(m.begin(), 3));
+ r = m.lower_bound(13);
+ assert(r == next(m.begin(), 4));
+ r = m.lower_bound(15);
+ assert(r == next(m.begin(), 5));
+ r = m.lower_bound(17);
+ assert(r == next(m.begin(), 6));
+ r = m.lower_bound(19);
+ assert(r == next(m.begin(), 7));
+ r = m.lower_bound(4);
+ assert(r == next(m.begin(), 0));
+ r = m.lower_bound(6);
+ assert(r == next(m.begin(), 1));
+ r = m.lower_bound(8);
+ assert(r == next(m.begin(), 2));
+ r = m.lower_bound(10);
+ assert(r == next(m.begin(), 3));
+ r = m.lower_bound(12);
+ assert(r == next(m.begin(), 4));
+ r = m.lower_bound(14);
+ assert(r == next(m.begin(), 5));
+ r = m.lower_bound(16);
+ assert(r == next(m.begin(), 6));
+ r = m.lower_bound(18);
+ assert(r == next(m.begin(), 7));
+ r = m.lower_bound(20);
+ assert(r == next(m.begin(), 8));
+ }
+ {
+ typedef M::const_iterator R;
+ V ar[] =
+ {
+ V(5, 5),
+ V(7, 6),
+ V(9, 7),
+ V(11, 8),
+ V(13, 9),
+ V(15, 10),
+ V(17, 11),
+ V(19, 12)
+ };
+ const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.lower_bound(5);
+ assert(r == m.begin());
+ r = m.lower_bound(7);
+ assert(r == next(m.begin()));
+ r = m.lower_bound(9);
+ assert(r == next(m.begin(), 2));
+ r = m.lower_bound(11);
+ assert(r == next(m.begin(), 3));
+ r = m.lower_bound(13);
+ assert(r == next(m.begin(), 4));
+ r = m.lower_bound(15);
+ assert(r == next(m.begin(), 5));
+ r = m.lower_bound(17);
+ assert(r == next(m.begin(), 6));
+ r = m.lower_bound(19);
+ assert(r == next(m.begin(), 7));
+ r = m.lower_bound(4);
+ assert(r == next(m.begin(), 0));
+ r = m.lower_bound(6);
+ assert(r == next(m.begin(), 1));
+ r = m.lower_bound(8);
+ assert(r == next(m.begin(), 2));
+ r = m.lower_bound(10);
+ assert(r == next(m.begin(), 3));
+ r = m.lower_bound(12);
+ assert(r == next(m.begin(), 4));
+ r = m.lower_bound(14);
+ assert(r == next(m.begin(), 5));
+ r = m.lower_bound(16);
+ assert(r == next(m.begin(), 6));
+ r = m.lower_bound(18);
+ assert(r == next(m.begin(), 7));
+ r = m.lower_bound(20);
+ assert(r == next(m.begin(), 8));
+ }
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/map/map.ops/upper_bound.pass.cpp b/libcxx/test/containers/associative/map/map.ops/upper_bound.pass.cpp
index 0d97e70ee4a..eee08aee31b 100644
--- a/libcxx/test/containers/associative/map/map.ops/upper_bound.pass.cpp
+++ b/libcxx/test/containers/associative/map/map.ops/upper_bound.pass.cpp
@@ -17,8 +17,11 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
+ {
typedef std::pair<const int, double> V;
typedef std::map<int, double> M;
{
@@ -119,4 +122,109 @@ int main()
r = m.upper_bound(20);
assert(r == next(m.begin(), 8));
}
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<const int, double> V;
+ typedef std::map<int, double, std::less<int>, min_allocator<V>> M;
+ {
+ typedef M::iterator R;
+ V ar[] =
+ {
+ V(5, 5),
+ V(7, 6),
+ V(9, 7),
+ V(11, 8),
+ V(13, 9),
+ V(15, 10),
+ V(17, 11),
+ V(19, 12)
+ };
+ M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.upper_bound(5);
+ assert(r == next(m.begin(), 1));
+ r = m.upper_bound(7);
+ assert(r == next(m.begin(), 2));
+ r = m.upper_bound(9);
+ assert(r == next(m.begin(), 3));
+ r = m.upper_bound(11);
+ assert(r == next(m.begin(), 4));
+ r = m.upper_bound(13);
+ assert(r == next(m.begin(), 5));
+ r = m.upper_bound(15);
+ assert(r == next(m.begin(), 6));
+ r = m.upper_bound(17);
+ assert(r == next(m.begin(), 7));
+ r = m.upper_bound(19);
+ assert(r == next(m.begin(), 8));
+ r = m.upper_bound(4);
+ assert(r == next(m.begin(), 0));
+ r = m.upper_bound(6);
+ assert(r == next(m.begin(), 1));
+ r = m.upper_bound(8);
+ assert(r == next(m.begin(), 2));
+ r = m.upper_bound(10);
+ assert(r == next(m.begin(), 3));
+ r = m.upper_bound(12);
+ assert(r == next(m.begin(), 4));
+ r = m.upper_bound(14);
+ assert(r == next(m.begin(), 5));
+ r = m.upper_bound(16);
+ assert(r == next(m.begin(), 6));
+ r = m.upper_bound(18);
+ assert(r == next(m.begin(), 7));
+ r = m.upper_bound(20);
+ assert(r == next(m.begin(), 8));
+ }
+ {
+ typedef M::const_iterator R;
+ V ar[] =
+ {
+ V(5, 5),
+ V(7, 6),
+ V(9, 7),
+ V(11, 8),
+ V(13, 9),
+ V(15, 10),
+ V(17, 11),
+ V(19, 12)
+ };
+ const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.upper_bound(5);
+ assert(r == next(m.begin(), 1));
+ r = m.upper_bound(7);
+ assert(r == next(m.begin(), 2));
+ r = m.upper_bound(9);
+ assert(r == next(m.begin(), 3));
+ r = m.upper_bound(11);
+ assert(r == next(m.begin(), 4));
+ r = m.upper_bound(13);
+ assert(r == next(m.begin(), 5));
+ r = m.upper_bound(15);
+ assert(r == next(m.begin(), 6));
+ r = m.upper_bound(17);
+ assert(r == next(m.begin(), 7));
+ r = m.upper_bound(19);
+ assert(r == next(m.begin(), 8));
+ r = m.upper_bound(4);
+ assert(r == next(m.begin(), 0));
+ r = m.upper_bound(6);
+ assert(r == next(m.begin(), 1));
+ r = m.upper_bound(8);
+ assert(r == next(m.begin(), 2));
+ r = m.upper_bound(10);
+ assert(r == next(m.begin(), 3));
+ r = m.upper_bound(12);
+ assert(r == next(m.begin(), 4));
+ r = m.upper_bound(14);
+ assert(r == next(m.begin(), 5));
+ r = m.upper_bound(16);
+ assert(r == next(m.begin(), 6));
+ r = m.upper_bound(18);
+ assert(r == next(m.begin(), 7));
+ r = m.upper_bound(20);
+ assert(r == next(m.begin(), 8));
+ }
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/map/map.special/member_swap.pass.cpp b/libcxx/test/containers/associative/map/map.special/member_swap.pass.cpp
index 84513450e50..af5922526a0 100644
--- a/libcxx/test/containers/associative/map/map.special/member_swap.pass.cpp
+++ b/libcxx/test/containers/associative/map/map.special/member_swap.pass.cpp
@@ -16,8 +16,11 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
+ {
typedef std::pair<const int, double> V;
typedef std::map<int, double> M;
{
@@ -104,4 +107,95 @@ int main()
assert(m1 == m2_save);
assert(m2 == m1_save);
}
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<const int, double> V;
+ typedef std::map<int, double, std::less<int>, min_allocator<V>> M;
+ {
+ V ar1[] =
+ {
+ };
+ V ar2[] =
+ {
+ };
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ }
+ {
+ V ar1[] =
+ {
+ };
+ V ar2[] =
+ {
+ V(5, 5),
+ V(6, 6),
+ V(7, 7),
+ V(8, 8),
+ V(9, 9),
+ V(10, 10),
+ V(11, 11),
+ V(12, 12)
+ };
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ }
+ {
+ V ar1[] =
+ {
+ V(1, 1),
+ V(2, 2),
+ V(3, 3),
+ V(4, 4)
+ };
+ V ar2[] =
+ {
+ };
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ }
+ {
+ V ar1[] =
+ {
+ V(1, 1),
+ V(2, 2),
+ V(3, 3),
+ V(4, 4)
+ };
+ V ar2[] =
+ {
+ V(5, 5),
+ V(6, 6),
+ V(7, 7),
+ V(8, 8),
+ V(9, 9),
+ V(10, 10),
+ V(11, 11),
+ V(12, 12)
+ };
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ }
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/map/map.special/non_member_swap.pass.cpp b/libcxx/test/containers/associative/map/map.special/non_member_swap.pass.cpp
index ef67892a7a7..e474a4661bb 100644
--- a/libcxx/test/containers/associative/map/map.special/non_member_swap.pass.cpp
+++ b/libcxx/test/containers/associative/map/map.special/non_member_swap.pass.cpp
@@ -19,9 +19,11 @@
#include <cassert>
#include "../../../test_allocator.h"
#include "../../../test_compare.h"
+#include "../../../min_allocator.h"
int main()
{
+ {
typedef std::pair<const int, double> V;
typedef std::map<int, double> M;
{
@@ -176,4 +178,129 @@ int main()
assert(m2.key_comp() == C(1));
assert(m2.get_allocator() == A(1));
}
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<const int, double> V;
+ typedef std::map<int, double, std::less<int>, min_allocator<V>> M;
+ {
+ V ar1[] =
+ {
+ };
+ V ar2[] =
+ {
+ };
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ swap(m1, m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ }
+ {
+ V ar1[] =
+ {
+ };
+ V ar2[] =
+ {
+ V(5, 5),
+ V(6, 6),
+ V(7, 7),
+ V(8, 8),
+ V(9, 9),
+ V(10, 10),
+ V(11, 11),
+ V(12, 12)
+ };
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ swap(m1, m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ }
+ {
+ V ar1[] =
+ {
+ V(1, 1),
+ V(2, 2),
+ V(3, 3),
+ V(4, 4)
+ };
+ V ar2[] =
+ {
+ };
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ swap(m1, m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ }
+ {
+ V ar1[] =
+ {
+ V(1, 1),
+ V(2, 2),
+ V(3, 3),
+ V(4, 4)
+ };
+ V ar2[] =
+ {
+ V(5, 5),
+ V(6, 6),
+ V(7, 7),
+ V(8, 8),
+ V(9, 9),
+ V(10, 10),
+ V(11, 11),
+ V(12, 12)
+ };
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ swap(m1, m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ }
+ {
+ typedef min_allocator<V> A;
+ typedef test_compare<std::less<int> > C;
+ typedef std::map<int, double, C, A> M;
+ V ar1[] =
+ {
+ V(1, 1),
+ V(2, 2),
+ V(3, 3),
+ V(4, 4)
+ };
+ V ar2[] =
+ {
+ V(5, 5),
+ V(6, 6),
+ V(7, 7),
+ V(8, 8),
+ V(9, 9),
+ V(10, 10),
+ V(11, 11),
+ V(12, 12)
+ };
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]), C(1), A());
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]), C(2), A());
+ 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());
+ assert(m2.key_comp() == C(1));
+ assert(m2.get_allocator() == A());
+ }
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/map/types.pass.cpp b/libcxx/test/containers/associative/map/types.pass.cpp
index 313b7bdbbac..aca81dfb964 100644
--- a/libcxx/test/containers/associative/map/types.pass.cpp
+++ b/libcxx/test/containers/associative/map/types.pass.cpp
@@ -32,8 +32,11 @@
#include <map>
#include <type_traits>
+#include "../../min_allocator.h"
+
int main()
{
+ {
static_assert((std::is_same<std::map<int, double>::key_type, int>::value), "");
static_assert((std::is_same<std::map<int, double>::mapped_type, double>::value), "");
static_assert((std::is_same<std::map<int, double>::value_type, std::pair<const int, double> >::value), "");
@@ -45,4 +48,20 @@ int main()
static_assert((std::is_same<std::map<int, double>::const_pointer, const std::pair<const int, double>*>::value), "");
static_assert((std::is_same<std::map<int, double>::size_type, std::size_t>::value), "");
static_assert((std::is_same<std::map<int, double>::difference_type, std::ptrdiff_t>::value), "");
+ }
+#if __cplusplus >= 201103L
+ {
+ static_assert((std::is_same<std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>>::key_type, int>::value), "");
+ static_assert((std::is_same<std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>>::mapped_type, double>::value), "");
+ static_assert((std::is_same<std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>>::value_type, std::pair<const int, double> >::value), "");
+ static_assert((std::is_same<std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>>::key_compare, std::less<int> >::value), "");
+ static_assert((std::is_same<std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>>::allocator_type, min_allocator<std::pair<const int, double> > >::value), "");
+ static_assert((std::is_same<std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>>::reference, std::pair<const int, double>&>::value), "");
+ static_assert((std::is_same<std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>>::const_reference, const std::pair<const int, double>&>::value), "");
+ static_assert((std::is_same<std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>>::pointer, min_pointer<std::pair<const int, double>>>::value), "");
+ static_assert((std::is_same<std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>>::const_pointer, min_pointer<const std::pair<const int, double>>>::value), "");
+ static_assert((std::is_same<std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>>::size_type, std::size_t>::value), "");
+ static_assert((std::is_same<std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>>::difference_type, std::ptrdiff_t>::value), "");
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/multimap/empty.pass.cpp b/libcxx/test/containers/associative/multimap/empty.pass.cpp
index c54920e03bd..cafdb7344c8 100644
--- a/libcxx/test/containers/associative/multimap/empty.pass.cpp
+++ b/libcxx/test/containers/associative/multimap/empty.pass.cpp
@@ -16,8 +16,11 @@
#include <map>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
+ {
typedef std::multimap<int, double> M;
M m;
assert(m.empty());
@@ -25,4 +28,16 @@ int main()
assert(!m.empty());
m.clear();
assert(m.empty());
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ M m;
+ assert(m.empty());
+ m.insert(M::value_type(1, 1.5));
+ assert(!m.empty());
+ m.clear();
+ assert(m.empty());
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/multimap/iterator.pass.cpp b/libcxx/test/containers/associative/multimap/iterator.pass.cpp
index dfb2fdf5cd8..283b32dc912 100644
--- a/libcxx/test/containers/associative/multimap/iterator.pass.cpp
+++ b/libcxx/test/containers/associative/multimap/iterator.pass.cpp
@@ -29,6 +29,8 @@
#include <map>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -119,4 +121,94 @@ int main()
assert(i->second == d);
}
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] =
+ {
+ V(1, 1),
+ V(1, 1.5),
+ V(1, 2),
+ V(2, 1),
+ V(2, 1.5),
+ V(2, 2),
+ V(3, 1),
+ V(3, 1.5),
+ V(3, 2),
+ V(4, 1),
+ V(4, 1.5),
+ V(4, 2),
+ V(5, 1),
+ V(5, 1.5),
+ V(5, 2),
+ V(6, 1),
+ V(6, 1.5),
+ V(6, 2),
+ V(7, 1),
+ V(7, 1.5),
+ V(7, 2),
+ V(8, 1),
+ V(8, 1.5),
+ V(8, 2)
+ };
+ std::multimap<int, double, std::less<int>, min_allocator<V>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ assert(std::distance(m.begin(), m.end()) == m.size());
+ assert(std::distance(m.rbegin(), m.rend()) == m.size());
+ std::multimap<int, double, std::less<int>, min_allocator<V>>::iterator i;
+ i = m.begin();
+ std::multimap<int, double, std::less<int>, min_allocator<V>>::const_iterator k = i;
+ assert(i == k);
+ for (int j = 1; j <= 8; ++j)
+ for (double d = 1; d <= 2; d += .5, ++i)
+ {
+ assert(i->first == j);
+ assert(i->second == d);
+ i->second = 2.5;
+ assert(i->second == 2.5);
+ }
+ }
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] =
+ {
+ V(1, 1),
+ V(1, 1.5),
+ V(1, 2),
+ V(2, 1),
+ V(2, 1.5),
+ V(2, 2),
+ V(3, 1),
+ V(3, 1.5),
+ V(3, 2),
+ V(4, 1),
+ V(4, 1.5),
+ V(4, 2),
+ V(5, 1),
+ V(5, 1.5),
+ V(5, 2),
+ V(6, 1),
+ V(6, 1.5),
+ V(6, 2),
+ V(7, 1),
+ V(7, 1.5),
+ V(7, 2),
+ V(8, 1),
+ V(8, 1.5),
+ V(8, 2)
+ };
+ const std::multimap<int, double, std::less<int>, min_allocator<V>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ assert(std::distance(m.begin(), m.end()) == m.size());
+ assert(std::distance(m.cbegin(), m.cend()) == m.size());
+ assert(std::distance(m.rbegin(), m.rend()) == m.size());
+ assert(std::distance(m.crbegin(), m.crend()) == m.size());
+ std::multimap<int, double, std::less<int>, min_allocator<V>>::const_iterator i;
+ i = m.begin();
+ for (int j = 1; j <= 8; ++j)
+ for (double d = 1; d <= 2; d += .5, ++i)
+ {
+ assert(i->first == j);
+ assert(i->second == d);
+ }
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/multimap/max_size.pass.cpp b/libcxx/test/containers/associative/multimap/max_size.pass.cpp
index 2fcd56916ad..7bcb12a2e80 100644
--- a/libcxx/test/containers/associative/multimap/max_size.pass.cpp
+++ b/libcxx/test/containers/associative/multimap/max_size.pass.cpp
@@ -16,9 +16,20 @@
#include <map>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
+ {
typedef std::multimap<int, double> M;
M m;
assert(m.max_size() != 0);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ M m;
+ assert(m.max_size() != 0);
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/multimap/multimap.cons/alloc.pass.cpp b/libcxx/test/containers/associative/multimap/multimap.cons/alloc.pass.cpp
index 3087c2e4408..aa3b6e2e6d2 100644
--- a/libcxx/test/containers/associative/multimap/multimap.cons/alloc.pass.cpp
+++ b/libcxx/test/containers/associative/multimap/multimap.cons/alloc.pass.cpp
@@ -17,13 +17,26 @@
#include <cassert>
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
+ {
typedef std::less<int> C;
typedef test_allocator<std::pair<const int, double> > A;
std::multimap<int, double, C, A> m(A(5));
assert(m.empty());
assert(m.begin() == m.end());
assert(m.get_allocator() == A(5));
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::less<int> C;
+ typedef min_allocator<std::pair<const int, double> > A;
+ std::multimap<int, double, C, A> m(A{});
+ assert(m.empty());
+ assert(m.begin() == m.end());
+ assert(m.get_allocator() == A());
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/multimap/multimap.cons/assign_initializer_list.pass.cpp b/libcxx/test/containers/associative/multimap/multimap.cons/assign_initializer_list.pass.cpp
index 73e8f24ff48..8c658d4f61a 100644
--- a/libcxx/test/containers/associative/multimap/multimap.cons/assign_initializer_list.pass.cpp
+++ b/libcxx/test/containers/associative/multimap/multimap.cons/assign_initializer_list.pass.cpp
@@ -16,9 +16,12 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ {
typedef std::multimap<int, double> C;
typedef C::value_type V;
C m = {{20, 1}};
@@ -46,5 +49,37 @@ int main()
assert(*++i == V(3, 1));
assert(*++i == V(3, 1.5));
assert(*++i == V(3, 2));
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> C;
+ typedef C::value_type V;
+ C m = {{20, 1}};
+ m =
+ {
+ {1, 1},
+ {1, 1.5},
+ {1, 2},
+ {2, 1},
+ {2, 1.5},
+ {2, 2},
+ {3, 1},
+ {3, 1.5},
+ {3, 2}
+ };
+ assert(m.size() == 9);
+ assert(distance(m.begin(), m.end()) == 9);
+ C::const_iterator i = m.cbegin();
+ assert(*i == V(1, 1));
+ assert(*++i == V(1, 1.5));
+ assert(*++i == V(1, 2));
+ assert(*++i == V(2, 1));
+ assert(*++i == V(2, 1.5));
+ assert(*++i == V(2, 2));
+ assert(*++i == V(3, 1));
+ assert(*++i == V(3, 1.5));
+ assert(*++i == V(3, 2));
+ }
+#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
diff --git a/libcxx/test/containers/associative/multimap/multimap.cons/compare.pass.cpp b/libcxx/test/containers/associative/multimap/multimap.cons/compare.pass.cpp
index 594db420db5..99265ef72f8 100644
--- a/libcxx/test/containers/associative/multimap/multimap.cons/compare.pass.cpp
+++ b/libcxx/test/containers/associative/multimap/multimap.cons/compare.pass.cpp
@@ -17,12 +17,24 @@
#include <cassert>
#include "../../../test_compare.h"
+#include "../../../min_allocator.h"
int main()
{
+ {
typedef test_compare<std::less<int> > C;
std::multimap<int, double, C> m(C(3));
assert(m.empty());
assert(m.begin() == m.end());
assert(m.key_comp() == C(3));
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef test_compare<std::less<int> > C;
+ std::multimap<int, double, C, min_allocator<std::pair<const int, double>>> m(C(3));
+ assert(m.empty());
+ assert(m.begin() == m.end());
+ assert(m.key_comp() == C(3));
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/multimap/multimap.cons/compare_alloc.pass.cpp b/libcxx/test/containers/associative/multimap/multimap.cons/compare_alloc.pass.cpp
index 93546838b75..864a5429974 100644
--- a/libcxx/test/containers/associative/multimap/multimap.cons/compare_alloc.pass.cpp
+++ b/libcxx/test/containers/associative/multimap/multimap.cons/compare_alloc.pass.cpp
@@ -18,9 +18,11 @@
#include "../../../test_compare.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
+ {
typedef test_compare<std::less<int> > C;
typedef test_allocator<std::pair<const int, double> > A;
std::multimap<int, double, C, A> m(C(4), A(5));
@@ -28,4 +30,16 @@ int main()
assert(m.begin() == m.end());
assert(m.key_comp() == C(4));
assert(m.get_allocator() == A(5));
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef test_compare<std::less<int> > C;
+ typedef min_allocator<std::pair<const int, double> > A;
+ std::multimap<int, double, C, A> m(C(4), A());
+ assert(m.empty());
+ assert(m.begin() == m.end());
+ assert(m.key_comp() == C(4));
+ assert(m.get_allocator() == A());
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/multimap/multimap.cons/copy.pass.cpp b/libcxx/test/containers/associative/multimap/multimap.cons/copy.pass.cpp
index b995b6eb8c1..65a1e921a47 100644
--- a/libcxx/test/containers/associative/multimap/multimap.cons/copy.pass.cpp
+++ b/libcxx/test/containers/associative/multimap/multimap.cons/copy.pass.cpp
@@ -18,6 +18,7 @@
#include "../../../test_compare.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -73,4 +74,31 @@ int main()
assert(mo.key_comp() == C(5));
}
#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] =
+ {
+ V(1, 1),
+ V(1, 1.5),
+ V(1, 2),
+ V(2, 1),
+ V(2, 1.5),
+ V(2, 2),
+ V(3, 1),
+ V(3, 1.5),
+ V(3, 2),
+ };
+ typedef test_compare<std::less<int> > C;
+ typedef min_allocator<V> A;
+ std::multimap<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A());
+ std::multimap<int, double, C, A> m = mo;
+ assert(m == mo);
+ assert(m.get_allocator() == A());
+ assert(m.key_comp() == C(5));
+
+ assert(mo.get_allocator() == A());
+ assert(mo.key_comp() == C(5));
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/multimap/multimap.cons/copy_alloc.pass.cpp b/libcxx/test/containers/associative/multimap/multimap.cons/copy_alloc.pass.cpp
index bbbc397533d..a9cba17de93 100644
--- a/libcxx/test/containers/associative/multimap/multimap.cons/copy_alloc.pass.cpp
+++ b/libcxx/test/containers/associative/multimap/multimap.cons/copy_alloc.pass.cpp
@@ -18,9 +18,11 @@
#include "../../../test_compare.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
+ {
typedef std::pair<const int, double> V;
V ar[] =
{
@@ -44,4 +46,32 @@ int main()
assert(mo.get_allocator() == A(7));
assert(mo.key_comp() == C(5));
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] =
+ {
+ V(1, 1),
+ V(1, 1.5),
+ V(1, 2),
+ V(2, 1),
+ V(2, 1.5),
+ V(2, 2),
+ V(3, 1),
+ V(3, 1.5),
+ V(3, 2),
+ };
+ typedef test_compare<std::less<int> > C;
+ typedef min_allocator<V> A;
+ std::multimap<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A());
+ std::multimap<int, double, C, A> m(mo, A());
+ assert(m == mo);
+ assert(m.get_allocator() == A());
+ assert(m.key_comp() == C(5));
+
+ assert(mo.get_allocator() == A());
+ assert(mo.key_comp() == C(5));
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/multimap/multimap.cons/copy_assign.pass.cpp b/libcxx/test/containers/associative/multimap/multimap.cons/copy_assign.pass.cpp
index 9b698035124..533338c9683 100644
--- a/libcxx/test/containers/associative/multimap/multimap.cons/copy_assign.pass.cpp
+++ b/libcxx/test/containers/associative/multimap/multimap.cons/copy_assign.pass.cpp
@@ -18,6 +18,7 @@
#include "../../../test_compare.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -73,4 +74,32 @@ int main()
assert(mo.get_allocator() == A(2));
assert(mo.key_comp() == C(5));
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] =
+ {
+ V(1, 1),
+ V(1, 1.5),
+ V(1, 2),
+ V(2, 1),
+ V(2, 1.5),
+ V(2, 2),
+ V(3, 1),
+ V(3, 1.5),
+ V(3, 2),
+ };
+ typedef test_compare<std::less<int> > C;
+ typedef min_allocator<V> A;
+ std::multimap<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A());
+ std::multimap<int, double, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0])/2, C(3), A());
+ m = mo;
+ assert(m == mo);
+ assert(m.get_allocator() == A());
+ assert(m.key_comp() == C(5));
+
+ assert(mo.get_allocator() == A());
+ assert(mo.key_comp() == C(5));
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/multimap/multimap.cons/default.pass.cpp b/libcxx/test/containers/associative/multimap/multimap.cons/default.pass.cpp
index d2e3f60483b..ca8225f3738 100644
--- a/libcxx/test/containers/associative/multimap/multimap.cons/default.pass.cpp
+++ b/libcxx/test/containers/associative/multimap/multimap.cons/default.pass.cpp
@@ -16,9 +16,20 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
+ {
std::multimap<int, double> m;
assert(m.empty());
assert(m.begin() == m.end());
+ }
+#if __cplusplus >= 201103L
+ {
+ std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> m;
+ assert(m.empty());
+ assert(m.begin() == m.end());
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/multimap/multimap.cons/initializer_list.pass.cpp b/libcxx/test/containers/associative/multimap/multimap.cons/initializer_list.pass.cpp
index 7683506f663..139052c5730 100644
--- a/libcxx/test/containers/associative/multimap/multimap.cons/initializer_list.pass.cpp
+++ b/libcxx/test/containers/associative/multimap/multimap.cons/initializer_list.pass.cpp
@@ -16,9 +16,12 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ {
typedef std::multimap<int, double> C;
typedef C::value_type V;
C m =
@@ -45,5 +48,36 @@ int main()
assert(*++i == V(3, 1));
assert(*++i == V(3, 1.5));
assert(*++i == V(3, 2));
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> C;
+ typedef C::value_type V;
+ C m =
+ {
+ {1, 1},
+ {1, 1.5},
+ {1, 2},
+ {2, 1},
+ {2, 1.5},
+ {2, 2},
+ {3, 1},
+ {3, 1.5},
+ {3, 2}
+ };
+ assert(m.size() == 9);
+ assert(distance(m.begin(), m.end()) == 9);
+ C::const_iterator i = m.cbegin();
+ assert(*i == V(1, 1));
+ assert(*++i == V(1, 1.5));
+ assert(*++i == V(1, 2));
+ assert(*++i == V(2, 1));
+ assert(*++i == V(2, 1.5));
+ assert(*++i == V(2, 2));
+ assert(*++i == V(3, 1));
+ assert(*++i == V(3, 1.5));
+ assert(*++i == V(3, 2));
+ }
+#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
diff --git a/libcxx/test/containers/associative/multimap/multimap.cons/initializer_list_compare.pass.cpp b/libcxx/test/containers/associative/multimap/multimap.cons/initializer_list_compare.pass.cpp
index 6d7f546ea41..f2545c0cbc1 100644
--- a/libcxx/test/containers/associative/multimap/multimap.cons/initializer_list_compare.pass.cpp
+++ b/libcxx/test/containers/associative/multimap/multimap.cons/initializer_list_compare.pass.cpp
@@ -16,10 +16,12 @@
#include <map>
#include <cassert>
#include "../../../test_compare.h"
+#include "../../../min_allocator.h"
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ {
typedef test_compare<std::less<int> > Cmp;
typedef std::multimap<int, double, Cmp> C;
typedef C::value_type V;
@@ -50,5 +52,40 @@ int main()
assert(*++i == V(3, 1.5));
assert(*++i == V(3, 2));
assert(m.key_comp() == Cmp(4));
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef test_compare<std::less<int> > Cmp;
+ typedef std::multimap<int, double, Cmp, min_allocator<std::pair<const int, double>>> C;
+ typedef C::value_type V;
+ C m(
+ {
+ {1, 1},
+ {1, 1.5},
+ {1, 2},
+ {2, 1},
+ {2, 1.5},
+ {2, 2},
+ {3, 1},
+ {3, 1.5},
+ {3, 2}
+ },
+ Cmp(4)
+ );
+ assert(m.size() == 9);
+ assert(distance(m.begin(), m.end()) == 9);
+ C::const_iterator i = m.cbegin();
+ assert(*i == V(1, 1));
+ assert(*++i == V(1, 1.5));
+ assert(*++i == V(1, 2));
+ assert(*++i == V(2, 1));
+ assert(*++i == V(2, 1.5));
+ assert(*++i == V(2, 2));
+ assert(*++i == V(3, 1));
+ assert(*++i == V(3, 1.5));
+ assert(*++i == V(3, 2));
+ assert(m.key_comp() == Cmp(4));
+ }
+#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
diff --git a/libcxx/test/containers/associative/multimap/multimap.cons/initializer_list_compare_alloc.pass.cpp b/libcxx/test/containers/associative/multimap/multimap.cons/initializer_list_compare_alloc.pass.cpp
index 47b48f1ef80..3f4073be082 100644
--- a/libcxx/test/containers/associative/multimap/multimap.cons/initializer_list_compare_alloc.pass.cpp
+++ b/libcxx/test/containers/associative/multimap/multimap.cons/initializer_list_compare_alloc.pass.cpp
@@ -17,10 +17,12 @@
#include <cassert>
#include "../../../test_compare.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ {
typedef test_compare<std::less<int> > Cmp;
typedef test_allocator<std::pair<const int, double> > A;
typedef std::multimap<int, double, Cmp, A> C;
@@ -53,5 +55,42 @@ int main()
assert(*++i == V(3, 2));
assert(m.key_comp() == Cmp(4));
assert(m.get_allocator() == A(5));
+ }
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#if __cplusplus >= 201103L
+ {
+ typedef test_compare<std::less<int> > Cmp;
+ typedef min_allocator<std::pair<const int, double> > A;
+ typedef std::multimap<int, double, Cmp, A> C;
+ typedef C::value_type V;
+ C m(
+ {
+ {1, 1},
+ {1, 1.5},
+ {1, 2},
+ {2, 1},
+ {2, 1.5},
+ {2, 2},
+ {3, 1},
+ {3, 1.5},
+ {3, 2}
+ },
+ Cmp(4), A()
+ );
+ assert(m.size() == 9);
+ assert(distance(m.begin(), m.end()) == 9);
+ C::const_iterator i = m.cbegin();
+ assert(*i == V(1, 1));
+ assert(*++i == V(1, 1.5));
+ assert(*++i == V(1, 2));
+ assert(*++i == V(2, 1));
+ assert(*++i == V(2, 1.5));
+ assert(*++i == V(2, 2));
+ assert(*++i == V(3, 1));
+ assert(*++i == V(3, 1.5));
+ assert(*++i == V(3, 2));
+ assert(m.key_comp() == Cmp(4));
+ assert(m.get_allocator() == A());
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/multimap/multimap.cons/iter_iter.pass.cpp b/libcxx/test/containers/associative/multimap/multimap.cons/iter_iter.pass.cpp
index 00556ebcbf0..3095cb56f33 100644
--- a/libcxx/test/containers/associative/multimap/multimap.cons/iter_iter.pass.cpp
+++ b/libcxx/test/containers/associative/multimap/multimap.cons/iter_iter.pass.cpp
@@ -17,8 +17,11 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
+ {
typedef std::pair<const int, double> V;
V ar[] =
{
@@ -44,4 +47,34 @@ int main()
assert(*next(m.begin(), 6) == V(3, 1));
assert(*next(m.begin(), 7) == V(3, 1.5));
assert(*next(m.begin(), 8) == V(3, 2));
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] =
+ {
+ V(1, 1),
+ V(1, 1.5),
+ V(1, 2),
+ V(2, 1),
+ V(2, 1.5),
+ V(2, 2),
+ V(3, 1),
+ V(3, 1.5),
+ V(3, 2),
+ };
+ std::multimap<int, double, std::less<int>, min_allocator<V>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ assert(m.size() == 9);
+ assert(distance(m.begin(), m.end()) == 9);
+ assert(*m.begin() == V(1, 1));
+ assert(*next(m.begin()) == V(1, 1.5));
+ assert(*next(m.begin(), 2) == V(1, 2));
+ assert(*next(m.begin(), 3) == V(2, 1));
+ assert(*next(m.begin(), 4) == V(2, 1.5));
+ assert(*next(m.begin(), 5) == V(2, 2));
+ assert(*next(m.begin(), 6) == V(3, 1));
+ assert(*next(m.begin(), 7) == V(3, 1.5));
+ assert(*next(m.begin(), 8) == V(3, 2));
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/multimap/multimap.cons/iter_iter_comp.pass.cpp b/libcxx/test/containers/associative/multimap/multimap.cons/iter_iter_comp.pass.cpp
index 57f879615f6..267edc21061 100644
--- a/libcxx/test/containers/associative/multimap/multimap.cons/iter_iter_comp.pass.cpp
+++ b/libcxx/test/containers/associative/multimap/multimap.cons/iter_iter_comp.pass.cpp
@@ -19,9 +19,11 @@
#include <cassert>
#include "../../../test_compare.h"
+#include "../../../min_allocator.h"
int main()
{
+ {
typedef std::pair<const int, double> V;
V ar[] =
{
@@ -49,4 +51,36 @@ int main()
assert(*next(m.begin(), 6) == V(3, 1));
assert(*next(m.begin(), 7) == V(3, 1.5));
assert(*next(m.begin(), 8) == V(3, 2));
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] =
+ {
+ V(1, 1),
+ V(1, 1.5),
+ V(1, 2),
+ V(2, 1),
+ V(2, 1.5),
+ V(2, 2),
+ V(3, 1),
+ V(3, 1.5),
+ V(3, 2),
+ };
+ typedef test_compare<std::less<int> > C;
+ std::multimap<int, double, C, min_allocator<V>> m(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5));
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 9);
+ assert(distance(m.begin(), m.end()) == 9);
+ assert(*m.begin() == V(1, 1));
+ assert(*next(m.begin()) == V(1, 1.5));
+ assert(*next(m.begin(), 2) == V(1, 2));
+ assert(*next(m.begin(), 3) == V(2, 1));
+ assert(*next(m.begin(), 4) == V(2, 1.5));
+ assert(*next(m.begin(), 5) == V(2, 2));
+ assert(*next(m.begin(), 6) == V(3, 1));
+ assert(*next(m.begin(), 7) == V(3, 1.5));
+ assert(*next(m.begin(), 8) == V(3, 2));
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/multimap/multimap.cons/iter_iter_comp_alloc.pass.cpp b/libcxx/test/containers/associative/multimap/multimap.cons/iter_iter_comp_alloc.pass.cpp
index c7b0d97a5aa..883f64c8e93 100644
--- a/libcxx/test/containers/associative/multimap/multimap.cons/iter_iter_comp_alloc.pass.cpp
+++ b/libcxx/test/containers/associative/multimap/multimap.cons/iter_iter_comp_alloc.pass.cpp
@@ -20,9 +20,11 @@
#include "../../../test_compare.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
+ {
typedef std::pair<const int, double> V;
V ar[] =
{
@@ -52,4 +54,38 @@ int main()
assert(*next(m.begin(), 6) == V(3, 1));
assert(*next(m.begin(), 7) == V(3, 1.5));
assert(*next(m.begin(), 8) == V(3, 2));
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<const int, double> V;
+ V ar[] =
+ {
+ V(1, 1),
+ V(1, 1.5),
+ V(1, 2),
+ V(2, 1),
+ V(2, 1.5),
+ V(2, 2),
+ V(3, 1),
+ V(3, 1.5),
+ V(3, 2),
+ };
+ typedef test_compare<std::less<int> > C;
+ typedef min_allocator<V> A;
+ std::multimap<int, double, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A());
+ assert(m.get_allocator() == A());
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 9);
+ assert(distance(m.begin(), m.end()) == 9);
+ assert(*m.begin() == V(1, 1));
+ assert(*next(m.begin()) == V(1, 1.5));
+ assert(*next(m.begin(), 2) == V(1, 2));
+ assert(*next(m.begin(), 3) == V(2, 1));
+ assert(*next(m.begin(), 4) == V(2, 1.5));
+ assert(*next(m.begin(), 5) == V(2, 2));
+ assert(*next(m.begin(), 6) == V(3, 1));
+ assert(*next(m.begin(), 7) == V(3, 1.5));
+ assert(*next(m.begin(), 8) == V(3, 2));
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/multimap/multimap.cons/move.pass.cpp b/libcxx/test/containers/associative/multimap/multimap.cons/move.pass.cpp
index 815fc55676c..d6e835ca477 100644
--- a/libcxx/test/containers/associative/multimap/multimap.cons/move.pass.cpp
+++ b/libcxx/test/containers/associative/multimap/multimap.cons/move.pass.cpp
@@ -18,6 +18,7 @@
#include "../../../test_compare.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -74,5 +75,58 @@ int main()
assert(mo.size() == 0);
assert(distance(mo.begin(), mo.end()) == 0);
}
+#if __cplusplus >= 201103L
+ {
+ typedef test_compare<std::less<int> > C;
+ typedef min_allocator<V> A;
+ std::multimap<int, double, C, A> mo(C(5), A());
+ std::multimap<int, double, C, A> m = std::move(mo);
+ assert(m.get_allocator() == A());
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 0);
+ assert(distance(m.begin(), m.end()) == 0);
+
+ assert(mo.get_allocator() == A());
+ assert(mo.key_comp() == C(5));
+ assert(mo.size() == 0);
+ assert(distance(mo.begin(), mo.end()) == 0);
+ }
+ {
+ V ar[] =
+ {
+ V(1, 1),
+ V(1, 1.5),
+ V(1, 2),
+ V(2, 1),
+ V(2, 1.5),
+ V(2, 2),
+ V(3, 1),
+ V(3, 1.5),
+ V(3, 2),
+ };
+ typedef test_compare<std::less<int> > C;
+ typedef min_allocator<V> A;
+ std::multimap<int, double, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A());
+ std::multimap<int, double, C, A> m = std::move(mo);
+ assert(m.get_allocator() == A());
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 9);
+ assert(distance(m.begin(), m.end()) == 9);
+ assert(*m.begin() == V(1, 1));
+ assert(*next(m.begin()) == V(1, 1.5));
+ assert(*next(m.begin(), 2) == V(1, 2));
+ assert(*next(m.begin(), 3) == V(2, 1));
+ assert(*next(m.begin(), 4) == V(2, 1.5));
+ assert(*next(m.begin(), 5) == V(2, 2));
+ assert(*next(m.begin(), 6) == V(3, 1));
+ assert(*next(m.begin(), 7) == V(3, 1.5));
+ assert(*next(m.begin(), 8) == V(3, 2));
+
+ assert(mo.get_allocator() == A());
+ assert(mo.key_comp() == C(5));
+ assert(mo.size() == 0);
+ assert(distance(mo.begin(), mo.end()) == 0);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/libcxx/test/containers/associative/multimap/multimap.cons/move_alloc.pass.cpp b/libcxx/test/containers/associative/multimap/multimap.cons/move_alloc.pass.cpp
index ed5eb24abcb..c807b4ff558 100644
--- a/libcxx/test/containers/associative/multimap/multimap.cons/move_alloc.pass.cpp
+++ b/libcxx/test/containers/associative/multimap/multimap.cons/move_alloc.pass.cpp
@@ -19,6 +19,7 @@
#include "../../../MoveOnly.h"
#include "../../../test_compare.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -140,5 +141,46 @@ int main()
assert(m3.key_comp() == C(5));
assert(m1.empty());
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<MoveOnly, MoveOnly> V;
+ typedef std::pair<const MoveOnly, MoveOnly> VC;
+ typedef test_compare<std::less<MoveOnly> > C;
+ typedef min_allocator<VC> A;
+ typedef std::multimap<MoveOnly, MoveOnly, C, A> M;
+ typedef std::move_iterator<V*> I;
+ V a1[] =
+ {
+ V(1, 1),
+ V(1, 2),
+ V(1, 3),
+ V(2, 1),
+ V(2, 2),
+ V(2, 3),
+ V(3, 1),
+ V(3, 2),
+ V(3, 3)
+ };
+ M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A());
+ V a2[] =
+ {
+ V(1, 1),
+ V(1, 2),
+ V(1, 3),
+ V(2, 1),
+ V(2, 2),
+ V(2, 3),
+ V(3, 1),
+ V(3, 2),
+ V(3, 3)
+ };
+ M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A());
+ M m3(std::move(m1), A());
+ assert(m3 == m2);
+ assert(m3.get_allocator() == A());
+ assert(m3.key_comp() == C(5));
+ assert(m1.empty());
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/libcxx/test/containers/associative/multimap/multimap.cons/move_assign.pass.cpp b/libcxx/test/containers/associative/multimap/multimap.cons/move_assign.pass.cpp
index 4a1e2e95fcd..0aa7c185784 100644
--- a/libcxx/test/containers/associative/multimap/multimap.cons/move_assign.pass.cpp
+++ b/libcxx/test/containers/associative/multimap/multimap.cons/move_assign.pass.cpp
@@ -19,6 +19,7 @@
#include "../../../MoveOnly.h"
#include "../../../test_compare.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -143,5 +144,47 @@ int main()
assert(m3.key_comp() == C(5));
assert(m1.empty());
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<MoveOnly, MoveOnly> V;
+ typedef std::pair<const MoveOnly, MoveOnly> VC;
+ typedef test_compare<std::less<MoveOnly> > C;
+ typedef min_allocator<VC> A;
+ typedef std::multimap<MoveOnly, MoveOnly, C, A> M;
+ typedef std::move_iterator<V*> I;
+ V a1[] =
+ {
+ V(1, 1),
+ V(1, 2),
+ V(1, 3),
+ V(2, 1),
+ V(2, 2),
+ V(2, 3),
+ V(3, 1),
+ V(3, 2),
+ V(3, 3)
+ };
+ M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A());
+ V a2[] =
+ {
+ V(1, 1),
+ V(1, 2),
+ V(1, 3),
+ V(2, 1),
+ V(2, 2),
+ V(2, 3),
+ V(3, 1),
+ V(3, 2),
+ V(3, 3)
+ };
+ M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A());
+ M m3(C(3), A());
+ m3 = std::move(m1);
+ assert(m3 == m2);
+ assert(m3.get_allocator() == A());
+ assert(m3.key_comp() == C(5));
+ assert(m1.empty());
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/libcxx/test/containers/associative/multimap/multimap.modifiers/clear.pass.cpp b/libcxx/test/containers/associative/multimap/multimap.modifiers/clear.pass.cpp
index e10b06a0c26..4864ec1141b 100644
--- a/libcxx/test/containers/associative/multimap/multimap.modifiers/clear.pass.cpp
+++ b/libcxx/test/containers/associative/multimap/multimap.modifiers/clear.pass.cpp
@@ -16,6 +16,8 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
{
@@ -37,4 +39,25 @@ int main()
m.clear();
assert(m.size() == 0);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ typedef std::pair<int, double> P;
+ P ar[] =
+ {
+ P(1, 1.5),
+ P(2, 2.5),
+ P(3, 3.5),
+ P(4, 4.5),
+ P(5, 5.5),
+ P(6, 6.5),
+ P(7, 7.5),
+ P(8, 8.5),
+ };
+ M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
+ assert(m.size() == 8);
+ m.clear();
+ assert(m.size() == 0);
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/multimap/multimap.modifiers/emplace.pass.cpp b/libcxx/test/containers/associative/multimap/multimap.modifiers/emplace.pass.cpp
index 22406d8fb52..c91909e7224 100644
--- a/libcxx/test/containers/associative/multimap/multimap.modifiers/emplace.pass.cpp
+++ b/libcxx/test/containers/associative/multimap/multimap.modifiers/emplace.pass.cpp
@@ -19,6 +19,7 @@
#include "../../../Emplaceable.h"
#include "../../../DefaultOnly.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -80,5 +81,64 @@ int main()
assert(m.begin()->first == 2);
assert(m.begin()->second == 3.5);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::multimap<int, DefaultOnly, std::less<int>, min_allocator<std::pair<const int, DefaultOnly>>> M;
+ typedef M::iterator R;
+ M m;
+ assert(DefaultOnly::count == 0);
+ R r = m.emplace();
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(m.begin()->first == 0);
+ assert(m.begin()->second == DefaultOnly());
+ assert(DefaultOnly::count == 1);
+ r = m.emplace(1);
+ assert(r == next(m.begin()));
+ assert(m.size() == 2);
+ assert(next(m.begin())->first == 1);
+ assert(next(m.begin())->second == DefaultOnly());
+ assert(DefaultOnly::count == 2);
+ r = m.emplace(1);
+ assert(r == next(m.begin(), 2));
+ assert(m.size() == 3);
+ assert(next(m.begin(), 2)->first == 1);
+ assert(next(m.begin(), 2)->second == DefaultOnly());
+ assert(DefaultOnly::count == 3);
+ }
+ assert(DefaultOnly::count == 0);
+ {
+ typedef std::multimap<int, Emplaceable, std::less<int>, min_allocator<std::pair<const int, Emplaceable>>> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.emplace(2);
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == Emplaceable());
+ r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1),
+ std::forward_as_tuple(2, 3.5));
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(m.begin()->first == 1);
+ assert(m.begin()->second == Emplaceable(2, 3.5));
+ r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1),
+ std::forward_as_tuple(3, 3.5));
+ assert(r == next(m.begin()));
+ assert(m.size() == 3);
+ assert(r->first == 1);
+ assert(r->second == Emplaceable(3, 3.5));
+ }
+ {
+ typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.emplace(M::value_type(2, 3.5));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == 3.5);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/libcxx/test/containers/associative/multimap/multimap.modifiers/emplace_hint.pass.cpp b/libcxx/test/containers/associative/multimap/multimap.modifiers/emplace_hint.pass.cpp
index 4c3e468d594..8dc3195b711 100644
--- a/libcxx/test/containers/associative/multimap/multimap.modifiers/emplace_hint.pass.cpp
+++ b/libcxx/test/containers/associative/multimap/multimap.modifiers/emplace_hint.pass.cpp
@@ -19,6 +19,7 @@
#include "../../../Emplaceable.h"
#include "../../../DefaultOnly.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -82,5 +83,66 @@ int main()
assert(m.begin()->first == 2);
assert(m.begin()->second == 3.5);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::multimap<int, DefaultOnly, std::less<int>, min_allocator<std::pair<const int, DefaultOnly>>> M;
+ typedef M::iterator R;
+ M m;
+ assert(DefaultOnly::count == 0);
+ R r = m.emplace_hint(m.cend());
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(m.begin()->first == 0);
+ assert(m.begin()->second == DefaultOnly());
+ assert(DefaultOnly::count == 1);
+ r = m.emplace_hint(m.cend(), 1);
+ assert(r == next(m.begin()));
+ assert(m.size() == 2);
+ assert(next(m.begin())->first == 1);
+ assert(next(m.begin())->second == DefaultOnly());
+ assert(DefaultOnly::count == 2);
+ r = m.emplace_hint(m.cend(), 1);
+ assert(r == next(m.begin(), 2));
+ assert(m.size() == 3);
+ assert(next(m.begin(), 2)->first == 1);
+ assert(next(m.begin(), 2)->second == DefaultOnly());
+ assert(DefaultOnly::count == 3);
+ }
+ assert(DefaultOnly::count == 0);
+ {
+ typedef std::multimap<int, Emplaceable, std::less<int>, min_allocator<std::pair<const int, Emplaceable>>> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.emplace_hint(m.cend(), 2);
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == Emplaceable());
+ r = m.emplace_hint(m.cbegin(), std::piecewise_construct,
+ std::forward_as_tuple(1),
+ std::forward_as_tuple(2, 3.5));
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(m.begin()->first == 1);
+ assert(m.begin()->second == Emplaceable(2, 3.5));
+ r = m.emplace_hint(m.cbegin(), std::piecewise_construct,
+ std::forward_as_tuple(1),
+ std::forward_as_tuple(3, 3.5));
+ assert(r == m.begin());
+ assert(m.size() == 3);
+ assert(r->first == 1);
+ assert(r->second == Emplaceable(3, 3.5));
+ }
+ {
+ typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.emplace_hint(m.cend(), M::value_type(2, 3.5));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(m.begin()->first == 2);
+ assert(m.begin()->second == 3.5);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/libcxx/test/containers/associative/multimap/multimap.modifiers/erase_iter.pass.cpp b/libcxx/test/containers/associative/multimap/multimap.modifiers/erase_iter.pass.cpp
index 794d31176aa..d2979b1eecc 100644
--- a/libcxx/test/containers/associative/multimap/multimap.modifiers/erase_iter.pass.cpp
+++ b/libcxx/test/containers/associative/multimap/multimap.modifiers/erase_iter.pass.cpp
@@ -16,6 +16,8 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
{
@@ -145,4 +147,133 @@ int main()
assert(i == m.begin());
assert(i == m.end());
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ typedef std::pair<int, double> P;
+ typedef M::iterator I;
+ P ar[] =
+ {
+ P(1, 1),
+ P(1, 1.5),
+ P(1, 2),
+ P(2, 1),
+ P(2, 1.5),
+ P(2, 2),
+ P(3, 1),
+ P(3, 1.5),
+ P(3, 2),
+ };
+ M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
+ assert(m.size() == 9);
+ I i = m.erase(next(m.cbegin(), 3));
+ assert(m.size() == 8);
+ assert(i == next(m.begin(), 3));
+ assert(m.begin()->first == 1);
+ assert(m.begin()->second == 1);
+ assert(next(m.begin())->first == 1);
+ assert(next(m.begin())->second == 1.5);
+ assert(next(m.begin(), 2)->first == 1);
+ assert(next(m.begin(), 2)->second == 2);
+ assert(next(m.begin(), 3)->first == 2);
+ assert(next(m.begin(), 3)->second == 1.5);
+ assert(next(m.begin(), 4)->first == 2);
+ assert(next(m.begin(), 4)->second == 2);
+ assert(next(m.begin(), 5)->first == 3);
+ assert(next(m.begin(), 5)->second == 1);
+ assert(next(m.begin(), 6)->first == 3);
+ assert(next(m.begin(), 6)->second == 1.5);
+ assert(next(m.begin(), 7)->first == 3);
+ assert(next(m.begin(), 7)->second == 2);
+
+ i = m.erase(next(m.cbegin(), 0));
+ assert(m.size() == 7);
+ assert(i == m.begin());
+ assert(next(m.begin(), 0)->first == 1);
+ assert(next(m.begin(), 0)->second == 1.5);
+ assert(next(m.begin(), 1)->first == 1);
+ assert(next(m.begin(), 1)->second == 2);
+ assert(next(m.begin(), 2)->first == 2);
+ assert(next(m.begin(), 2)->second == 1.5);
+ assert(next(m.begin(), 3)->first == 2);
+ assert(next(m.begin(), 3)->second == 2);
+ assert(next(m.begin(), 4)->first == 3);
+ assert(next(m.begin(), 4)->second == 1);
+ assert(next(m.begin(), 5)->first == 3);
+ assert(next(m.begin(), 5)->second == 1.5);
+ assert(next(m.begin(), 6)->first == 3);
+ assert(next(m.begin(), 6)->second == 2);
+
+ i = m.erase(next(m.cbegin(), 5));
+ assert(m.size() == 6);
+ assert(i == prev(m.end()));
+ assert(next(m.begin(), 0)->first == 1);
+ assert(next(m.begin(), 0)->second == 1.5);
+ assert(next(m.begin(), 1)->first == 1);
+ assert(next(m.begin(), 1)->second == 2);
+ assert(next(m.begin(), 2)->first == 2);
+ assert(next(m.begin(), 2)->second == 1.5);
+ assert(next(m.begin(), 3)->first == 2);
+ assert(next(m.begin(), 3)->second == 2);
+ assert(next(m.begin(), 4)->first == 3);
+ assert(next(m.begin(), 4)->second == 1);
+ assert(next(m.begin(), 5)->first == 3);
+ assert(next(m.begin(), 5)->second == 2);
+
+ i = m.erase(next(m.cbegin(), 1));
+ assert(m.size() == 5);
+ assert(i == next(m.begin()));
+ assert(next(m.begin(), 0)->first == 1);
+ assert(next(m.begin(), 0)->second == 1.5);
+ assert(next(m.begin(), 1)->first == 2);
+ assert(next(m.begin(), 1)->second == 1.5);
+ assert(next(m.begin(), 2)->first == 2);
+ assert(next(m.begin(), 2)->second == 2);
+ assert(next(m.begin(), 3)->first == 3);
+ assert(next(m.begin(), 3)->second == 1);
+ assert(next(m.begin(), 4)->first == 3);
+ assert(next(m.begin(), 4)->second == 2);
+
+ i = m.erase(next(m.cbegin(), 2));
+ assert(m.size() == 4);
+ assert(i == next(m.begin(), 2));
+ assert(next(m.begin(), 0)->first == 1);
+ assert(next(m.begin(), 0)->second == 1.5);
+ assert(next(m.begin(), 1)->first == 2);
+ assert(next(m.begin(), 1)->second == 1.5);
+ assert(next(m.begin(), 2)->first == 3);
+ assert(next(m.begin(), 2)->second == 1);
+ assert(next(m.begin(), 3)->first == 3);
+ assert(next(m.begin(), 3)->second == 2);
+
+ i = m.erase(next(m.cbegin(), 2));
+ assert(m.size() == 3);
+ assert(i == next(m.begin(), 2));
+ assert(next(m.begin(), 0)->first == 1);
+ assert(next(m.begin(), 0)->second == 1.5);
+ assert(next(m.begin(), 1)->first == 2);
+ assert(next(m.begin(), 1)->second == 1.5);
+ assert(next(m.begin(), 2)->first == 3);
+ assert(next(m.begin(), 2)->second == 2);
+
+ i = m.erase(next(m.cbegin(), 0));
+ assert(m.size() == 2);
+ assert(i == next(m.begin(), 0));
+ assert(next(m.begin(), 0)->first == 2);
+ assert(next(m.begin(), 0)->second == 1.5);
+ assert(next(m.begin(), 1)->first == 3);
+ assert(next(m.begin(), 1)->second == 2);
+
+ i = m.erase(next(m.cbegin(), 1));
+ assert(m.size() == 1);
+ assert(i == m.end());
+ assert(next(m.begin(), 0)->first == 2);
+ assert(next(m.begin(), 0)->second == 1.5);
+
+ i = m.erase(m.cbegin());
+ assert(m.size() == 0);
+ assert(i == m.begin());
+ assert(i == m.end());
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/multimap/multimap.modifiers/erase_iter_iter.pass.cpp b/libcxx/test/containers/associative/multimap/multimap.modifiers/erase_iter_iter.pass.cpp
index 954c56db509..be1ab6f8d23 100644
--- a/libcxx/test/containers/associative/multimap/multimap.modifiers/erase_iter_iter.pass.cpp
+++ b/libcxx/test/containers/associative/multimap/multimap.modifiers/erase_iter_iter.pass.cpp
@@ -16,6 +16,8 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
{
@@ -84,4 +86,72 @@ int main()
assert(i == m.begin());
assert(i == m.end());
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ typedef std::pair<int, double> P;
+ typedef M::iterator I;
+ P ar[] =
+ {
+ P(1, 1.5),
+ P(2, 2.5),
+ P(3, 3.5),
+ P(4, 4.5),
+ P(5, 5.5),
+ P(6, 6.5),
+ P(7, 7.5),
+ P(8, 8.5),
+ };
+ M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
+ assert(m.size() == 8);
+ I i = m.erase(m.cbegin(), m.cbegin());
+ assert(m.size() == 8);
+ assert(i == m.begin());
+ assert(m.begin()->first == 1);
+ assert(m.begin()->second == 1.5);
+ assert(next(m.begin())->first == 2);
+ assert(next(m.begin())->second == 2.5);
+ assert(next(m.begin(), 2)->first == 3);
+ assert(next(m.begin(), 2)->second == 3.5);
+ assert(next(m.begin(), 3)->first == 4);
+ assert(next(m.begin(), 3)->second == 4.5);
+ assert(next(m.begin(), 4)->first == 5);
+ assert(next(m.begin(), 4)->second == 5.5);
+ assert(next(m.begin(), 5)->first == 6);
+ assert(next(m.begin(), 5)->second == 6.5);
+ assert(next(m.begin(), 6)->first == 7);
+ assert(next(m.begin(), 6)->second == 7.5);
+ assert(next(m.begin(), 7)->first == 8);
+ assert(next(m.begin(), 7)->second == 8.5);
+
+ i = m.erase(m.cbegin(), next(m.cbegin(), 2));
+ assert(m.size() == 6);
+ assert(i == m.begin());
+ assert(next(m.begin(), 0)->first == 3);
+ assert(next(m.begin(), 0)->second == 3.5);
+ assert(next(m.begin(), 1)->first == 4);
+ assert(next(m.begin(), 1)->second == 4.5);
+ assert(next(m.begin(), 2)->first == 5);
+ assert(next(m.begin(), 2)->second == 5.5);
+ assert(next(m.begin(), 3)->first == 6);
+ assert(next(m.begin(), 3)->second == 6.5);
+ assert(next(m.begin(), 4)->first == 7);
+ assert(next(m.begin(), 4)->second == 7.5);
+ assert(next(m.begin(), 5)->first == 8);
+ assert(next(m.begin(), 5)->second == 8.5);
+
+ i = m.erase(next(m.cbegin(), 2), next(m.cbegin(), 6));
+ assert(m.size() == 2);
+ assert(i == next(m.begin(), 2));
+ assert(next(m.begin(), 0)->first == 3);
+ assert(next(m.begin(), 0)->second == 3.5);
+ assert(next(m.begin(), 1)->first == 4);
+ assert(next(m.begin(), 1)->second == 4.5);
+
+ i = m.erase(m.cbegin(), m.cend());
+ assert(m.size() == 0);
+ assert(i == m.begin());
+ assert(i == m.end());
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/multimap/multimap.modifiers/erase_key.pass.cpp b/libcxx/test/containers/associative/multimap/multimap.modifiers/erase_key.pass.cpp
index cdf5b9db023..c5dd6fbdcc7 100644
--- a/libcxx/test/containers/associative/multimap/multimap.modifiers/erase_key.pass.cpp
+++ b/libcxx/test/containers/associative/multimap/multimap.modifiers/erase_key.pass.cpp
@@ -16,6 +16,8 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
{
@@ -81,4 +83,69 @@ int main()
assert(m.size() == 0);
assert(i == 3);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ typedef std::pair<int, double> P;
+ typedef M::size_type I;
+ P ar[] =
+ {
+ P(1, 1),
+ P(1, 1.5),
+ P(1, 2),
+ P(2, 1),
+ P(2, 1.5),
+ P(2, 2),
+ P(3, 1),
+ P(3, 1.5),
+ P(3, 2),
+ };
+ M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
+ assert(m.size() == 9);
+ I i = m.erase(2);
+ assert(m.size() == 6);
+ assert(i == 3);
+ assert(next(m.begin(), 0)->first == 1);
+ assert(next(m.begin(), 0)->second == 1);
+ assert(next(m.begin(), 1)->first == 1);
+ assert(next(m.begin(), 1)->second == 1.5);
+ assert(next(m.begin(), 2)->first == 1);
+ assert(next(m.begin(), 2)->second == 2);
+ assert(next(m.begin(), 3)->first == 3);
+ assert(next(m.begin(), 3)->second == 1);
+ assert(next(m.begin(), 4)->first == 3);
+ assert(next(m.begin(), 4)->second == 1.5);
+ assert(next(m.begin(), 5)->first == 3);
+ assert(next(m.begin(), 5)->second == 2);
+
+ i = m.erase(2);
+ assert(m.size() == 6);
+ assert(i == 0);
+ assert(next(m.begin(), 0)->first == 1);
+ assert(next(m.begin(), 0)->second == 1);
+ assert(next(m.begin(), 1)->first == 1);
+ assert(next(m.begin(), 1)->second == 1.5);
+ assert(next(m.begin(), 2)->first == 1);
+ assert(next(m.begin(), 2)->second == 2);
+ assert(next(m.begin(), 3)->first == 3);
+ assert(next(m.begin(), 3)->second == 1);
+ assert(next(m.begin(), 4)->first == 3);
+ assert(next(m.begin(), 4)->second == 1.5);
+ assert(next(m.begin(), 5)->first == 3);
+ assert(next(m.begin(), 5)->second == 2);
+
+ i = m.erase(3);
+ assert(m.size() == 3);
+ assert(next(m.begin(), 0)->first == 1);
+ assert(next(m.begin(), 0)->second == 1);
+ assert(next(m.begin(), 1)->first == 1);
+ assert(next(m.begin(), 1)->second == 1.5);
+ assert(next(m.begin(), 2)->first == 1);
+ assert(next(m.begin(), 2)->second == 2);
+
+ i = m.erase(1);
+ assert(m.size() == 0);
+ assert(i == 3);
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/multimap/multimap.modifiers/insert_cv.pass.cpp b/libcxx/test/containers/associative/multimap/multimap.modifiers/insert_cv.pass.cpp
index 4ad2704be0a..c23d821e0bb 100644
--- a/libcxx/test/containers/associative/multimap/multimap.modifiers/insert_cv.pass.cpp
+++ b/libcxx/test/containers/associative/multimap/multimap.modifiers/insert_cv.pass.cpp
@@ -16,6 +16,8 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
{
@@ -46,4 +48,34 @@ int main()
assert(r->first == 3);
assert(r->second == 3.5);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.insert(M::value_type(2, 2.5));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(r->first == 2);
+ assert(r->second == 2.5);
+
+ r = m.insert(M::value_type(1, 1.5));
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(r->first == 1);
+ assert(r->second == 1.5);
+
+ r = m.insert(M::value_type(3, 3.5));
+ assert(r == prev(m.end()));
+ assert(m.size() == 3);
+ assert(r->first == 3);
+ assert(r->second == 3.5);
+
+ r = m.insert(M::value_type(3, 3.5));
+ assert(r == prev(m.end()));
+ assert(m.size() == 4);
+ assert(r->first == 3);
+ assert(r->second == 3.5);
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/multimap/multimap.modifiers/insert_initializer_list.pass.cpp b/libcxx/test/containers/associative/multimap/multimap.modifiers/insert_initializer_list.pass.cpp
index 26a9cb8cfd9..8fc080d013f 100644
--- a/libcxx/test/containers/associative/multimap/multimap.modifiers/insert_initializer_list.pass.cpp
+++ b/libcxx/test/containers/associative/multimap/multimap.modifiers/insert_initializer_list.pass.cpp
@@ -16,9 +16,12 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ {
typedef std::multimap<int, double> C;
typedef C::value_type V;
C m =
@@ -49,5 +52,40 @@ int main()
assert(*++i == V(3, 1));
assert(*++i == V(3, 2));
assert(*++i == V(3, 1.5));
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> C;
+ typedef C::value_type V;
+ C m =
+ {
+ {1, 1},
+ {1, 2},
+ {2, 1},
+ {2, 2},
+ {3, 1},
+ {3, 2}
+ };
+ m.insert(
+ {
+ {1, 1.5},
+ {2, 1.5},
+ {3, 1.5},
+ }
+ );
+ assert(m.size() == 9);
+ assert(distance(m.begin(), m.end()) == 9);
+ C::const_iterator i = m.cbegin();
+ assert(*i == V(1, 1));
+ assert(*++i == V(1, 2));
+ assert(*++i == V(1, 1.5));
+ assert(*++i == V(2, 1));
+ assert(*++i == V(2, 2));
+ assert(*++i == V(2, 1.5));
+ assert(*++i == V(3, 1));
+ assert(*++i == V(3, 2));
+ assert(*++i == V(3, 1.5));
+ }
+#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
diff --git a/libcxx/test/containers/associative/multimap/multimap.modifiers/insert_iter_cv.pass.cpp b/libcxx/test/containers/associative/multimap/multimap.modifiers/insert_iter_cv.pass.cpp
index ebe49012cd0..0c8e9168731 100644
--- a/libcxx/test/containers/associative/multimap/multimap.modifiers/insert_iter_cv.pass.cpp
+++ b/libcxx/test/containers/associative/multimap/multimap.modifiers/insert_iter_cv.pass.cpp
@@ -16,6 +16,8 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
{
@@ -46,4 +48,34 @@ int main()
assert(r->first == 3);
assert(r->second == 4.5);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.insert(m.end(), M::value_type(2, 2.5));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(r->first == 2);
+ assert(r->second == 2.5);
+
+ r = m.insert(m.end(), M::value_type(1, 1.5));
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(r->first == 1);
+ assert(r->second == 1.5);
+
+ r = m.insert(m.end(), M::value_type(3, 3.5));
+ assert(r == prev(m.end()));
+ assert(m.size() == 3);
+ assert(r->first == 3);
+ assert(r->second == 3.5);
+
+ r = m.insert(prev(m.end()), M::value_type(3, 4.5));
+ assert(r == prev(m.end(), 2));
+ assert(m.size() == 4);
+ assert(r->first == 3);
+ assert(r->second == 4.5);
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/multimap/multimap.modifiers/insert_iter_iter.pass.cpp b/libcxx/test/containers/associative/multimap/multimap.modifiers/insert_iter_iter.pass.cpp
index fcd4cee8f9b..6e3d2f26bc3 100644
--- a/libcxx/test/containers/associative/multimap/multimap.modifiers/insert_iter_iter.pass.cpp
+++ b/libcxx/test/containers/associative/multimap/multimap.modifiers/insert_iter_iter.pass.cpp
@@ -18,6 +18,7 @@
#include <cassert>
#include "test_iterators.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -58,4 +59,43 @@ int main()
assert(next(m.begin(), 8)->first == 3);
assert(next(m.begin(), 8)->second == 2);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ typedef std::pair<int, double> P;
+ P ar[] =
+ {
+ P(1, 1),
+ P(1, 1.5),
+ P(1, 2),
+ P(2, 1),
+ P(2, 1.5),
+ P(2, 2),
+ P(3, 1),
+ P(3, 1.5),
+ P(3, 2),
+ };
+ M m;
+ m.insert(input_iterator<P*>(ar), input_iterator<P*>(ar + sizeof(ar)/sizeof(ar[0])));
+ assert(m.size() == 9);
+ assert(m.begin()->first == 1);
+ assert(m.begin()->second == 1);
+ assert(next(m.begin())->first == 1);
+ assert(next(m.begin())->second == 1.5);
+ assert(next(m.begin(), 2)->first == 1);
+ assert(next(m.begin(), 2)->second == 2);
+ assert(next(m.begin(), 3)->first == 2);
+ assert(next(m.begin(), 3)->second == 1);
+ assert(next(m.begin(), 4)->first == 2);
+ assert(next(m.begin(), 4)->second == 1.5);
+ assert(next(m.begin(), 5)->first == 2);
+ assert(next(m.begin(), 5)->second == 2);
+ assert(next(m.begin(), 6)->first == 3);
+ assert(next(m.begin(), 6)->second == 1);
+ assert(next(m.begin(), 7)->first == 3);
+ assert(next(m.begin(), 7)->second == 1.5);
+ assert(next(m.begin(), 8)->first == 3);
+ assert(next(m.begin(), 8)->second == 2);
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/multimap/multimap.modifiers/insert_iter_rv.pass.cpp b/libcxx/test/containers/associative/multimap/multimap.modifiers/insert_iter_rv.pass.cpp
index 15993cbfd31..efc99e1e762 100644
--- a/libcxx/test/containers/associative/multimap/multimap.modifiers/insert_iter_rv.pass.cpp
+++ b/libcxx/test/containers/associative/multimap/multimap.modifiers/insert_iter_rv.pass.cpp
@@ -18,6 +18,7 @@
#include <cassert>
#include "../../../MoveOnly.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -51,5 +52,36 @@ int main()
assert(r->first == 3);
assert(r->second == 2);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::multimap<int, MoveOnly, std::less<int>, min_allocator<std::pair<const int, MoveOnly>>> M;
+ typedef std::pair<int, MoveOnly> P;
+ typedef M::iterator R;
+ M m;
+ R r = m.insert(m.cend(), P(2, 2));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(r->first == 2);
+ assert(r->second == 2);
+
+ r = m.insert(m.cend(), P(1, 1));
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(r->first == 1);
+ assert(r->second == 1);
+
+ r = m.insert(m.cend(), P(3, 3));
+ assert(r == prev(m.end()));
+ assert(m.size() == 3);
+ assert(r->first == 3);
+ assert(r->second == 3);
+
+ r = m.insert(m.cend(), P(3, 2));
+ assert(r == prev(m.end()));
+ assert(m.size() == 4);
+ assert(r->first == 3);
+ assert(r->second == 2);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/libcxx/test/containers/associative/multimap/multimap.modifiers/insert_rv.pass.cpp b/libcxx/test/containers/associative/multimap/multimap.modifiers/insert_rv.pass.cpp
index 285881cac71..1678c9de89e 100644
--- a/libcxx/test/containers/associative/multimap/multimap.modifiers/insert_rv.pass.cpp
+++ b/libcxx/test/containers/associative/multimap/multimap.modifiers/insert_rv.pass.cpp
@@ -18,6 +18,7 @@
#include <cassert>
#include "../../../MoveOnly.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -50,5 +51,35 @@ int main()
assert(r->first == 3);
assert(r->second == 3);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::multimap<int, MoveOnly, std::less<int>, min_allocator<std::pair<const int, MoveOnly>>> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.insert(M::value_type(2, 2));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(r->first == 2);
+ assert(r->second == 2);
+
+ r = m.insert(M::value_type(1, 1));
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(r->first == 1);
+ assert(r->second == 1);
+
+ r = m.insert(M::value_type(3, 3));
+ assert(r == prev(m.end()));
+ assert(m.size() == 3);
+ assert(r->first == 3);
+ assert(r->second == 3);
+
+ r = m.insert(M::value_type(3, 3));
+ assert(r == prev(m.end()));
+ assert(m.size() == 4);
+ assert(r->first == 3);
+ assert(r->second == 3);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/libcxx/test/containers/associative/multimap/multimap.ops/count.pass.cpp b/libcxx/test/containers/associative/multimap/multimap.ops/count.pass.cpp
index e707cd70066..b0e4c58873c 100644
--- a/libcxx/test/containers/associative/multimap/multimap.ops/count.pass.cpp
+++ b/libcxx/test/containers/associative/multimap/multimap.ops/count.pass.cpp
@@ -16,9 +16,12 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
typedef std::pair<const int, double> V;
+ {
typedef std::multimap<int, double> M;
{
typedef M::size_type R;
@@ -50,4 +53,40 @@ int main()
r = m.count(10);
assert(r == 0);
}
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ {
+ typedef M::size_type R;
+ V ar[] =
+ {
+ V(5, 1),
+ V(5, 2),
+ V(5, 3),
+ V(7, 1),
+ V(7, 2),
+ V(7, 3),
+ V(9, 1),
+ V(9, 2),
+ V(9, 3)
+ };
+ const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.count(4);
+ assert(r == 0);
+ r = m.count(5);
+ assert(r == 3);
+ r = m.count(6);
+ assert(r == 0);
+ r = m.count(7);
+ assert(r == 3);
+ r = m.count(8);
+ assert(r == 0);
+ r = m.count(9);
+ assert(r == 3);
+ r = m.count(10);
+ assert(r == 0);
+ }
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/multimap/multimap.ops/equal_range.pass.cpp b/libcxx/test/containers/associative/multimap/multimap.ops/equal_range.pass.cpp
index 73f392cad10..030d4681ded 100644
--- a/libcxx/test/containers/associative/multimap/multimap.ops/equal_range.pass.cpp
+++ b/libcxx/test/containers/associative/multimap/multimap.ops/equal_range.pass.cpp
@@ -17,9 +17,12 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
typedef std::pair<const int, double> V;
+ {
typedef std::multimap<int, double> M;
{
typedef std::pair<M::iterator, M::iterator> R;
@@ -95,4 +98,84 @@ int main()
assert(r.first == m.end());
assert(r.second == m.end());
}
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ {
+ typedef std::pair<M::iterator, M::iterator> R;
+ V ar[] =
+ {
+ V(5, 1),
+ V(5, 2),
+ V(5, 3),
+ V(7, 1),
+ V(7, 2),
+ V(7, 3),
+ V(9, 1),
+ V(9, 2),
+ V(9, 3)
+ };
+ M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.equal_range(4);
+ assert(r.first == m.begin());
+ assert(r.second == m.begin());
+ r = m.equal_range(5);
+ assert(r.first == m.begin());
+ assert(r.second == next(m.begin(), 3));
+ r = m.equal_range(6);
+ assert(r.first == next(m.begin(), 3));
+ assert(r.second == next(m.begin(), 3));
+ r = m.equal_range(7);
+ assert(r.first == next(m.begin(), 3));
+ assert(r.second == next(m.begin(), 6));
+ r = m.equal_range(8);
+ assert(r.first == next(m.begin(), 6));
+ assert(r.second == next(m.begin(), 6));
+ r = m.equal_range(9);
+ assert(r.first == next(m.begin(), 6));
+ assert(r.second == next(m.begin(), 9));
+ r = m.equal_range(10);
+ assert(r.first == m.end());
+ assert(r.second == m.end());
+ }
+ {
+ typedef std::pair<M::const_iterator, M::const_iterator> R;
+ V ar[] =
+ {
+ V(5, 1),
+ V(5, 2),
+ V(5, 3),
+ V(7, 1),
+ V(7, 2),
+ V(7, 3),
+ V(9, 1),
+ V(9, 2),
+ V(9, 3)
+ };
+ const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.equal_range(4);
+ assert(r.first == m.begin());
+ assert(r.second == m.begin());
+ r = m.equal_range(5);
+ assert(r.first == m.begin());
+ assert(r.second == next(m.begin(), 3));
+ r = m.equal_range(6);
+ assert(r.first == next(m.begin(), 3));
+ assert(r.second == next(m.begin(), 3));
+ r = m.equal_range(7);
+ assert(r.first == next(m.begin(), 3));
+ assert(r.second == next(m.begin(), 6));
+ r = m.equal_range(8);
+ assert(r.first == next(m.begin(), 6));
+ assert(r.second == next(m.begin(), 6));
+ r = m.equal_range(9);
+ assert(r.first == next(m.begin(), 6));
+ assert(r.second == next(m.begin(), 9));
+ r = m.equal_range(10);
+ assert(r.first == m.end());
+ assert(r.second == m.end());
+ }
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/multimap/multimap.ops/find.pass.cpp b/libcxx/test/containers/associative/multimap/multimap.ops/find.pass.cpp
index fe7e34f5fb2..aa22d3971fd 100644
--- a/libcxx/test/containers/associative/multimap/multimap.ops/find.pass.cpp
+++ b/libcxx/test/containers/associative/multimap/multimap.ops/find.pass.cpp
@@ -17,9 +17,12 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
typedef std::pair<const int, double> V;
+ {
typedef std::multimap<int, double> M;
{
typedef M::iterator R;
@@ -77,4 +80,66 @@ int main()
r = m.find(10);
assert(r == m.end());
}
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ {
+ typedef M::iterator R;
+ V ar[] =
+ {
+ V(5, 1),
+ V(5, 2),
+ V(5, 3),
+ V(7, 1),
+ V(7, 2),
+ V(7, 3),
+ V(9, 1),
+ V(9, 2),
+ V(9, 3)
+ };
+ M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.find(5);
+ assert(r == m.begin());
+ r = m.find(6);
+ assert(r == m.end());
+ r = m.find(7);
+ assert(r == next(m.begin(), 3));
+ r = m.find(8);
+ assert(r == m.end());
+ r = m.find(9);
+ assert(r == next(m.begin(), 6));
+ r = m.find(10);
+ assert(r == m.end());
+ }
+ {
+ typedef M::const_iterator R;
+ V ar[] =
+ {
+ V(5, 1),
+ V(5, 2),
+ V(5, 3),
+ V(7, 1),
+ V(7, 2),
+ V(7, 3),
+ V(9, 1),
+ V(9, 2),
+ V(9, 3)
+ };
+ const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.find(5);
+ assert(r == m.begin());
+ r = m.find(6);
+ assert(r == m.end());
+ r = m.find(7);
+ assert(r == next(m.begin(), 3));
+ r = m.find(8);
+ assert(r == m.end());
+ r = m.find(9);
+ assert(r == next(m.begin(), 6));
+ r = m.find(10);
+ assert(r == m.end());
+ }
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/multimap/multimap.ops/lower_bound.pass.cpp b/libcxx/test/containers/associative/multimap/multimap.ops/lower_bound.pass.cpp
index fe682f18297..508b077b2ee 100644
--- a/libcxx/test/containers/associative/multimap/multimap.ops/lower_bound.pass.cpp
+++ b/libcxx/test/containers/associative/multimap/multimap.ops/lower_bound.pass.cpp
@@ -17,9 +17,12 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
typedef std::pair<const int, double> V;
+ {
typedef std::multimap<int, double> M;
{
typedef M::iterator R;
@@ -81,4 +84,70 @@ int main()
r = m.lower_bound(10);
assert(r == m.end());
}
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ {
+ typedef M::iterator R;
+ V ar[] =
+ {
+ V(5, 1),
+ V(5, 2),
+ V(5, 3),
+ V(7, 1),
+ V(7, 2),
+ V(7, 3),
+ V(9, 1),
+ V(9, 2),
+ V(9, 3)
+ };
+ M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.lower_bound(4);
+ assert(r == m.begin());
+ r = m.lower_bound(5);
+ assert(r == m.begin());
+ r = m.lower_bound(6);
+ assert(r == next(m.begin(), 3));
+ r = m.lower_bound(7);
+ assert(r == next(m.begin(), 3));
+ r = m.lower_bound(8);
+ assert(r == next(m.begin(), 6));
+ r = m.lower_bound(9);
+ assert(r == next(m.begin(), 6));
+ r = m.lower_bound(10);
+ assert(r == m.end());
+ }
+ {
+ typedef M::const_iterator R;
+ V ar[] =
+ {
+ V(5, 1),
+ V(5, 2),
+ V(5, 3),
+ V(7, 1),
+ V(7, 2),
+ V(7, 3),
+ V(9, 1),
+ V(9, 2),
+ V(9, 3)
+ };
+ const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.lower_bound(4);
+ assert(r == m.begin());
+ r = m.lower_bound(5);
+ assert(r == m.begin());
+ r = m.lower_bound(6);
+ assert(r == next(m.begin(), 3));
+ r = m.lower_bound(7);
+ assert(r == next(m.begin(), 3));
+ r = m.lower_bound(8);
+ assert(r == next(m.begin(), 6));
+ r = m.lower_bound(9);
+ assert(r == next(m.begin(), 6));
+ r = m.lower_bound(10);
+ assert(r == m.end());
+ }
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/multimap/multimap.ops/upper_bound.pass.cpp b/libcxx/test/containers/associative/multimap/multimap.ops/upper_bound.pass.cpp
index 3d6bd88a9f2..6f40c20d997 100644
--- a/libcxx/test/containers/associative/multimap/multimap.ops/upper_bound.pass.cpp
+++ b/libcxx/test/containers/associative/multimap/multimap.ops/upper_bound.pass.cpp
@@ -17,9 +17,12 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
typedef std::pair<const int, double> V;
+ {
typedef std::multimap<int, double> M;
{
typedef M::iterator R;
@@ -81,4 +84,70 @@ int main()
r = m.upper_bound(10);
assert(r == m.end());
}
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ {
+ typedef M::iterator R;
+ V ar[] =
+ {
+ V(5, 1),
+ V(5, 2),
+ V(5, 3),
+ V(7, 1),
+ V(7, 2),
+ V(7, 3),
+ V(9, 1),
+ V(9, 2),
+ V(9, 3)
+ };
+ M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.upper_bound(4);
+ assert(r == m.begin());
+ r = m.upper_bound(5);
+ assert(r == next(m.begin(), 3));
+ r = m.upper_bound(6);
+ assert(r == next(m.begin(), 3));
+ r = m.upper_bound(7);
+ assert(r == next(m.begin(), 6));
+ r = m.upper_bound(8);
+ assert(r == next(m.begin(), 6));
+ r = m.upper_bound(9);
+ assert(r == next(m.begin(), 9));
+ r = m.upper_bound(10);
+ assert(r == m.end());
+ }
+ {
+ typedef M::const_iterator R;
+ V ar[] =
+ {
+ V(5, 1),
+ V(5, 2),
+ V(5, 3),
+ V(7, 1),
+ V(7, 2),
+ V(7, 3),
+ V(9, 1),
+ V(9, 2),
+ V(9, 3)
+ };
+ const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.upper_bound(4);
+ assert(r == m.begin());
+ r = m.upper_bound(5);
+ assert(r == next(m.begin(), 3));
+ r = m.upper_bound(6);
+ assert(r == next(m.begin(), 3));
+ r = m.upper_bound(7);
+ assert(r == next(m.begin(), 6));
+ r = m.upper_bound(8);
+ assert(r == next(m.begin(), 6));
+ r = m.upper_bound(9);
+ assert(r == next(m.begin(), 9));
+ r = m.upper_bound(10);
+ assert(r == m.end());
+ }
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/multimap/multimap.special/member_swap.pass.cpp b/libcxx/test/containers/associative/multimap/multimap.special/member_swap.pass.cpp
index 05d1260319c..1e1ab2335ab 100644
--- a/libcxx/test/containers/associative/multimap/multimap.special/member_swap.pass.cpp
+++ b/libcxx/test/containers/associative/multimap/multimap.special/member_swap.pass.cpp
@@ -16,9 +16,12 @@
#include <map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
typedef std::pair<const int, double> V;
+ {
typedef std::multimap<int, double> M;
{
V ar1[] =
@@ -104,4 +107,94 @@ int main()
assert(m1 == m2_save);
assert(m2 == m1_save);
}
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ {
+ V ar1[] =
+ {
+ };
+ V ar2[] =
+ {
+ };
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ }
+ {
+ V ar1[] =
+ {
+ };
+ V ar2[] =
+ {
+ V(5, 5),
+ V(6, 6),
+ V(7, 7),
+ V(8, 8),
+ V(9, 9),
+ V(10, 10),
+ V(11, 11),
+ V(12, 12)
+ };
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ }
+ {
+ V ar1[] =
+ {
+ V(1, 1),
+ V(2, 2),
+ V(3, 3),
+ V(4, 4)
+ };
+ V ar2[] =
+ {
+ };
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ }
+ {
+ V ar1[] =
+ {
+ V(1, 1),
+ V(2, 2),
+ V(3, 3),
+ V(4, 4)
+ };
+ V ar2[] =
+ {
+ V(5, 5),
+ V(6, 6),
+ V(7, 7),
+ V(8, 8),
+ V(9, 9),
+ V(10, 10),
+ V(11, 11),
+ V(12, 12)
+ };
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ }
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/multimap/multimap.special/non_member_swap.pass.cpp b/libcxx/test/containers/associative/multimap/multimap.special/non_member_swap.pass.cpp
index 390340f1799..6f5b92fe1fe 100644
--- a/libcxx/test/containers/associative/multimap/multimap.special/non_member_swap.pass.cpp
+++ b/libcxx/test/containers/associative/multimap/multimap.special/non_member_swap.pass.cpp
@@ -19,10 +19,12 @@
#include <cassert>
#include "../../../test_allocator.h"
#include "../../../test_compare.h"
+#include "../../../min_allocator.h"
int main()
{
typedef std::pair<const int, double> V;
+ {
typedef std::multimap<int, double> M;
{
V ar1[] =
@@ -176,4 +178,128 @@ int main()
assert(m2.key_comp() == C(1));
assert(m2.get_allocator() == A(1));
}
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ {
+ V ar1[] =
+ {
+ };
+ V ar2[] =
+ {
+ };
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ swap(m1, m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ }
+ {
+ V ar1[] =
+ {
+ };
+ V ar2[] =
+ {
+ V(5, 5),
+ V(6, 6),
+ V(7, 7),
+ V(8, 8),
+ V(9, 9),
+ V(10, 10),
+ V(11, 11),
+ V(12, 12)
+ };
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ swap(m1, m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ }
+ {
+ V ar1[] =
+ {
+ V(1, 1),
+ V(2, 2),
+ V(3, 3),
+ V(4, 4)
+ };
+ V ar2[] =
+ {
+ };
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ swap(m1, m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ }
+ {
+ V ar1[] =
+ {
+ V(1, 1),
+ V(2, 2),
+ V(3, 3),
+ V(4, 4)
+ };
+ V ar2[] =
+ {
+ V(5, 5),
+ V(6, 6),
+ V(7, 7),
+ V(8, 8),
+ V(9, 9),
+ V(10, 10),
+ V(11, 11),
+ V(12, 12)
+ };
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ swap(m1, m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ }
+ {
+ typedef min_allocator<V> A;
+ typedef test_compare<std::less<int> > C;
+ typedef std::multimap<int, double, C, A> M;
+ V ar1[] =
+ {
+ V(1, 1),
+ V(2, 2),
+ V(3, 3),
+ V(4, 4)
+ };
+ V ar2[] =
+ {
+ V(5, 5),
+ V(6, 6),
+ V(7, 7),
+ V(8, 8),
+ V(9, 9),
+ V(10, 10),
+ V(11, 11),
+ V(12, 12)
+ };
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]), C(1), A());
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]), C(2), A());
+ 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());
+ assert(m2.key_comp() == C(1));
+ assert(m2.get_allocator() == A());
+ }
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/multimap/size.pass.cpp b/libcxx/test/containers/associative/multimap/size.pass.cpp
index eb7b1c914ae..794c34a2846 100644
--- a/libcxx/test/containers/associative/multimap/size.pass.cpp
+++ b/libcxx/test/containers/associative/multimap/size.pass.cpp
@@ -16,8 +16,11 @@
#include <map>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
+ {
typedef std::multimap<int, double> M;
M m;
assert(m.size() == 0);
@@ -33,4 +36,24 @@ int main()
assert(m.size() == 1);
m.erase(m.begin());
assert(m.size() == 0);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
+ M m;
+ assert(m.size() == 0);
+ m.insert(M::value_type(2, 1.5));
+ assert(m.size() == 1);
+ m.insert(M::value_type(1, 1.5));
+ assert(m.size() == 2);
+ m.insert(M::value_type(3, 1.5));
+ assert(m.size() == 3);
+ m.erase(m.begin());
+ assert(m.size() == 2);
+ m.erase(m.begin());
+ assert(m.size() == 1);
+ m.erase(m.begin());
+ assert(m.size() == 0);
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/multimap/types.pass.cpp b/libcxx/test/containers/associative/multimap/types.pass.cpp
index 4bb72422747..2fe8fe0eabf 100644
--- a/libcxx/test/containers/associative/multimap/types.pass.cpp
+++ b/libcxx/test/containers/associative/multimap/types.pass.cpp
@@ -32,8 +32,11 @@
#include <map>
#include <type_traits>
+#include "../../min_allocator.h"
+
int main()
{
+ {
static_assert((std::is_same<std::multimap<int, double>::key_type, int>::value), "");
static_assert((std::is_same<std::multimap<int, double>::mapped_type, double>::value), "");
static_assert((std::is_same<std::multimap<int, double>::value_type, std::pair<const int, double> >::value), "");
@@ -45,4 +48,20 @@ int main()
static_assert((std::is_same<std::multimap<int, double>::const_pointer, const std::pair<const int, double>*>::value), "");
static_assert((std::is_same<std::multimap<int, double>::size_type, std::size_t>::value), "");
static_assert((std::is_same<std::multimap<int, double>::difference_type, std::ptrdiff_t>::value), "");
+ }
+#if __cplusplus >= 201103L
+ {
+ static_assert((std::is_same<std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>>::key_type, int>::value), "");
+ static_assert((std::is_same<std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>>::mapped_type, double>::value), "");
+ static_assert((std::is_same<std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>>::value_type, std::pair<const int, double> >::value), "");
+ static_assert((std::is_same<std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>>::key_compare, std::less<int> >::value), "");
+ static_assert((std::is_same<std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>>::allocator_type, min_allocator<std::pair<const int, double> > >::value), "");
+ static_assert((std::is_same<std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>>::reference, std::pair<const int, double>&>::value), "");
+ static_assert((std::is_same<std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>>::const_reference, const std::pair<const int, double>&>::value), "");
+ static_assert((std::is_same<std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>>::pointer, min_pointer<std::pair<const int, double>>>::value), "");
+ static_assert((std::is_same<std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>>::const_pointer, min_pointer<const std::pair<const int, double>>>::value), "");
+ static_assert((std::is_same<std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>>::size_type, std::size_t>::value), "");
+ static_assert((std::is_same<std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>>::difference_type, std::ptrdiff_t>::value), "");
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/multiset/clear.pass.cpp b/libcxx/test/containers/associative/multiset/clear.pass.cpp
index f91b74f03e0..f325a701abe 100644
--- a/libcxx/test/containers/associative/multiset/clear.pass.cpp
+++ b/libcxx/test/containers/associative/multiset/clear.pass.cpp
@@ -16,6 +16,8 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -37,4 +39,25 @@ int main()
m.clear();
assert(m.size() == 0);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
+ typedef int V;
+ V ar[] =
+ {
+ 1,
+ 2,
+ 3,
+ 4,
+ 5,
+ 6,
+ 7,
+ 8
+ };
+ M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
+ assert(m.size() == 8);
+ m.clear();
+ assert(m.size() == 0);
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/multiset/count.pass.cpp b/libcxx/test/containers/associative/multiset/count.pass.cpp
index 726c80594ca..cba64301a33 100644
--- a/libcxx/test/containers/associative/multiset/count.pass.cpp
+++ b/libcxx/test/containers/associative/multiset/count.pass.cpp
@@ -16,8 +16,11 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
+ {
typedef int V;
typedef std::multiset<int> M;
{
@@ -50,4 +53,41 @@ int main()
r = m.count(10);
assert(r == 0);
}
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef int V;
+ typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
+ {
+ typedef M::size_type R;
+ V ar[] =
+ {
+ 5,
+ 5,
+ 5,
+ 5,
+ 7,
+ 7,
+ 7,
+ 9,
+ 9
+ };
+ const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.count(4);
+ assert(r == 0);
+ r = m.count(5);
+ assert(r == 4);
+ r = m.count(6);
+ assert(r == 0);
+ r = m.count(7);
+ assert(r == 3);
+ r = m.count(8);
+ assert(r == 0);
+ r = m.count(9);
+ assert(r == 2);
+ r = m.count(10);
+ assert(r == 0);
+ }
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/multiset/emplace.pass.cpp b/libcxx/test/containers/associative/multiset/emplace.pass.cpp
index 55f11fce207..08ac42b1d13 100644
--- a/libcxx/test/containers/associative/multiset/emplace.pass.cpp
+++ b/libcxx/test/containers/associative/multiset/emplace.pass.cpp
@@ -19,6 +19,7 @@
#include "../../Emplaceable.h"
#include "../../DefaultOnly.h"
+#include "../../min_allocator.h"
int main()
{
@@ -67,5 +68,16 @@ int main()
assert(m.size() == 1);
assert(*r == 2);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.emplace(M::value_type(2));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(*r == 2);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/libcxx/test/containers/associative/multiset/emplace_hint.pass.cpp b/libcxx/test/containers/associative/multiset/emplace_hint.pass.cpp
index 9e4befa7119..1510c010477 100644
--- a/libcxx/test/containers/associative/multiset/emplace_hint.pass.cpp
+++ b/libcxx/test/containers/associative/multiset/emplace_hint.pass.cpp
@@ -19,6 +19,7 @@
#include "../../Emplaceable.h"
#include "../../DefaultOnly.h"
+#include "../../min_allocator.h"
int main()
{
@@ -67,5 +68,16 @@ int main()
assert(m.size() == 1);
assert(*r == 2);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.emplace_hint(m.cend(), M::value_type(2));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(*r == 2);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/libcxx/test/containers/associative/multiset/empty.pass.cpp b/libcxx/test/containers/associative/multiset/empty.pass.cpp
index 8213fbb70c1..154180def46 100644
--- a/libcxx/test/containers/associative/multiset/empty.pass.cpp
+++ b/libcxx/test/containers/associative/multiset/empty.pass.cpp
@@ -16,8 +16,11 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
+ {
typedef std::multiset<int> M;
M m;
assert(m.empty());
@@ -25,4 +28,16 @@ int main()
assert(!m.empty());
m.clear();
assert(m.empty());
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
+ M m;
+ assert(m.empty());
+ m.insert(M::value_type(1));
+ assert(!m.empty());
+ m.clear();
+ assert(m.empty());
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/multiset/equal_range.pass.cpp b/libcxx/test/containers/associative/multiset/equal_range.pass.cpp
index 4d8cd98b9dd..fee94bc97cd 100644
--- a/libcxx/test/containers/associative/multiset/equal_range.pass.cpp
+++ b/libcxx/test/containers/associative/multiset/equal_range.pass.cpp
@@ -17,8 +17,11 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
+ {
typedef int V;
typedef std::multiset<int> M;
{
@@ -95,4 +98,85 @@ int main()
assert(r.first == next(m.begin(), 9));
assert(r.second == next(m.begin(), 9));
}
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef int V;
+ typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
+ {
+ typedef std::pair<M::iterator, M::iterator> R;
+ V ar[] =
+ {
+ 5,
+ 5,
+ 5,
+ 7,
+ 7,
+ 7,
+ 9,
+ 9,
+ 9
+ };
+ M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.equal_range(4);
+ assert(r.first == next(m.begin(), 0));
+ assert(r.second == next(m.begin(), 0));
+ r = m.equal_range(5);
+ assert(r.first == next(m.begin(), 0));
+ assert(r.second == next(m.begin(), 3));
+ r = m.equal_range(6);
+ assert(r.first == next(m.begin(), 3));
+ assert(r.second == next(m.begin(), 3));
+ r = m.equal_range(7);
+ assert(r.first == next(m.begin(), 3));
+ assert(r.second == next(m.begin(), 6));
+ r = m.equal_range(8);
+ assert(r.first == next(m.begin(), 6));
+ assert(r.second == next(m.begin(), 6));
+ r = m.equal_range(9);
+ assert(r.first == next(m.begin(), 6));
+ assert(r.second == next(m.begin(), 9));
+ r = m.equal_range(10);
+ assert(r.first == next(m.begin(), 9));
+ assert(r.second == next(m.begin(), 9));
+ }
+ {
+ typedef std::pair<M::const_iterator, M::const_iterator> R;
+ V ar[] =
+ {
+ 5,
+ 5,
+ 5,
+ 7,
+ 7,
+ 7,
+ 9,
+ 9,
+ 9
+ };
+ M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.equal_range(4);
+ assert(r.first == next(m.begin(), 0));
+ assert(r.second == next(m.begin(), 0));
+ r = m.equal_range(5);
+ assert(r.first == next(m.begin(), 0));
+ assert(r.second == next(m.begin(), 3));
+ r = m.equal_range(6);
+ assert(r.first == next(m.begin(), 3));
+ assert(r.second == next(m.begin(), 3));
+ r = m.equal_range(7);
+ assert(r.first == next(m.begin(), 3));
+ assert(r.second == next(m.begin(), 6));
+ r = m.equal_range(8);
+ assert(r.first == next(m.begin(), 6));
+ assert(r.second == next(m.begin(), 6));
+ r = m.equal_range(9);
+ assert(r.first == next(m.begin(), 6));
+ assert(r.second == next(m.begin(), 9));
+ r = m.equal_range(10);
+ assert(r.first == next(m.begin(), 9));
+ assert(r.second == next(m.begin(), 9));
+ }
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/multiset/erase_iter.pass.cpp b/libcxx/test/containers/associative/multiset/erase_iter.pass.cpp
index 207a720bdc2..3657f521cb1 100644
--- a/libcxx/test/containers/associative/multiset/erase_iter.pass.cpp
+++ b/libcxx/test/containers/associative/multiset/erase_iter.pass.cpp
@@ -16,6 +16,8 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -96,4 +98,84 @@ int main()
assert(i == m.begin());
assert(i == m.end());
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
+ typedef int V;
+ typedef M::iterator I;
+ V ar[] =
+ {
+ 1,
+ 2,
+ 3,
+ 4,
+ 5,
+ 6,
+ 7,
+ 8
+ };
+ M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
+ assert(m.size() == 8);
+ I i = m.erase(next(m.cbegin(), 3));
+ assert(m.size() == 7);
+ assert(i == next(m.begin(), 3));
+ assert(*next(m.begin(), 0) == 1);
+ assert(*next(m.begin(), 1) == 2);
+ assert(*next(m.begin(), 2) == 3);
+ assert(*next(m.begin(), 3) == 5);
+ assert(*next(m.begin(), 4) == 6);
+ assert(*next(m.begin(), 5) == 7);
+ assert(*next(m.begin(), 6) == 8);
+
+ i = m.erase(next(m.cbegin(), 0));
+ assert(m.size() == 6);
+ assert(i == m.begin());
+ assert(*next(m.begin(), 0) == 2);
+ assert(*next(m.begin(), 1) == 3);
+ assert(*next(m.begin(), 2) == 5);
+ assert(*next(m.begin(), 3) == 6);
+ assert(*next(m.begin(), 4) == 7);
+ assert(*next(m.begin(), 5) == 8);
+
+ i = m.erase(next(m.cbegin(), 5));
+ assert(m.size() == 5);
+ assert(i == m.end());
+ assert(*next(m.begin(), 0) == 2);
+ assert(*next(m.begin(), 1) == 3);
+ assert(*next(m.begin(), 2) == 5);
+ assert(*next(m.begin(), 3) == 6);
+ assert(*next(m.begin(), 4) == 7);
+
+ i = m.erase(next(m.cbegin(), 1));
+ assert(m.size() == 4);
+ assert(i == next(m.begin()));
+ assert(*next(m.begin(), 0) == 2);
+ assert(*next(m.begin(), 1) == 5);
+ assert(*next(m.begin(), 2) == 6);
+ assert(*next(m.begin(), 3) == 7);
+
+ i = m.erase(next(m.cbegin(), 2));
+ assert(m.size() == 3);
+ assert(i == next(m.begin(), 2));
+ assert(*next(m.begin(), 0) == 2);
+ assert(*next(m.begin(), 1) == 5);
+ assert(*next(m.begin(), 2) == 7);
+
+ i = m.erase(next(m.cbegin(), 2));
+ assert(m.size() == 2);
+ assert(i == next(m.begin(), 2));
+ assert(*next(m.begin(), 0) == 2);
+ assert(*next(m.begin(), 1) == 5);
+
+ i = m.erase(next(m.cbegin(), 0));
+ assert(m.size() == 1);
+ assert(i == next(m.begin(), 0));
+ assert(*next(m.begin(), 0) == 5);
+
+ i = m.erase(m.cbegin());
+ assert(m.size() == 0);
+ assert(i == m.begin());
+ assert(i == m.end());
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/multiset/erase_iter_iter.pass.cpp b/libcxx/test/containers/associative/multiset/erase_iter_iter.pass.cpp
index 091212815a1..de4c8783bf3 100644
--- a/libcxx/test/containers/associative/multiset/erase_iter_iter.pass.cpp
+++ b/libcxx/test/containers/associative/multiset/erase_iter_iter.pass.cpp
@@ -16,6 +16,8 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -76,4 +78,64 @@ int main()
assert(m.size() == 0);
assert(i == m.end());
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
+ typedef int V;
+ typedef M::iterator I;
+ V ar[] =
+ {
+ 1,
+ 2,
+ 3,
+ 4,
+ 5,
+ 6,
+ 7,
+ 8
+ };
+ M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
+ assert(m.size() == 8);
+ I i = m.erase(next(m.cbegin(), 5), next(m.cbegin(), 5));
+ assert(m.size() == 8);
+ assert(i == next(m.begin(), 5));
+ assert(*next(m.begin(), 0) == 1);
+ assert(*next(m.begin(), 1) == 2);
+ assert(*next(m.begin(), 2) == 3);
+ assert(*next(m.begin(), 3) == 4);
+ assert(*next(m.begin(), 4) == 5);
+ assert(*next(m.begin(), 5) == 6);
+ assert(*next(m.begin(), 6) == 7);
+ assert(*next(m.begin(), 7) == 8);
+
+ i = m.erase(next(m.cbegin(), 3), next(m.cbegin(), 4));
+ assert(m.size() == 7);
+ assert(i == next(m.begin(), 3));
+ assert(*next(m.begin(), 0) == 1);
+ assert(*next(m.begin(), 1) == 2);
+ assert(*next(m.begin(), 2) == 3);
+ assert(*next(m.begin(), 3) == 5);
+ assert(*next(m.begin(), 4) == 6);
+ assert(*next(m.begin(), 5) == 7);
+ assert(*next(m.begin(), 6) == 8);
+
+ i = m.erase(next(m.cbegin(), 2), next(m.cbegin(), 5));
+ assert(m.size() == 4);
+ assert(i == next(m.begin(), 2));
+ assert(*next(m.begin(), 0) == 1);
+ assert(*next(m.begin(), 1) == 2);
+ assert(*next(m.begin(), 2) == 7);
+ assert(*next(m.begin(), 3) == 8);
+
+ i = m.erase(next(m.cbegin(), 0), next(m.cbegin(), 2));
+ assert(m.size() == 2);
+ assert(i == next(m.begin(), 0));
+ assert(*next(m.begin(), 0) == 7);
+ assert(*next(m.begin(), 1) == 8);
+
+ i = m.erase(m.cbegin(), m.cend());
+ assert(m.size() == 0);
+ assert(i == m.end());
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/multiset/erase_key.pass.cpp b/libcxx/test/containers/associative/multiset/erase_key.pass.cpp
index 20ba86df10a..170232904c4 100644
--- a/libcxx/test/containers/associative/multiset/erase_key.pass.cpp
+++ b/libcxx/test/containers/associative/multiset/erase_key.pass.cpp
@@ -16,6 +16,8 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -70,4 +72,58 @@ int main()
assert(m.size() == 0);
assert(i == 3);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
+ typedef int V;
+ typedef M::size_type I;
+ V ar[] =
+ {
+ 3,
+ 3,
+ 3,
+ 5,
+ 5,
+ 5,
+ 7,
+ 7,
+ 7
+ };
+ M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
+ assert(m.size() == 9);
+ I i = m.erase(6);
+ assert(m.size() == 9);
+ assert(i == 0);
+ assert(*next(m.begin(), 0) == 3);
+ assert(*next(m.begin(), 1) == 3);
+ assert(*next(m.begin(), 2) == 3);
+ assert(*next(m.begin(), 3) == 5);
+ assert(*next(m.begin(), 4) == 5);
+ assert(*next(m.begin(), 5) == 5);
+ assert(*next(m.begin(), 6) == 7);
+ assert(*next(m.begin(), 7) == 7);
+ assert(*next(m.begin(), 8) == 7);
+
+ i = m.erase(5);
+ assert(m.size() == 6);
+ assert(i == 3);
+ assert(*next(m.begin(), 0) == 3);
+ assert(*next(m.begin(), 1) == 3);
+ assert(*next(m.begin(), 2) == 3);
+ assert(*next(m.begin(), 3) == 7);
+ assert(*next(m.begin(), 4) == 7);
+ assert(*next(m.begin(), 5) == 7);
+
+ i = m.erase(3);
+ assert(m.size() == 3);
+ assert(i == 3);
+ assert(*next(m.begin(), 0) == 7);
+ assert(*next(m.begin(), 1) == 7);
+ assert(*next(m.begin(), 2) == 7);
+
+ i = m.erase(7);
+ assert(m.size() == 0);
+ assert(i == 3);
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/multiset/find.pass.cpp b/libcxx/test/containers/associative/multiset/find.pass.cpp
index f2af8f61741..53b1844e8ef 100644
--- a/libcxx/test/containers/associative/multiset/find.pass.cpp
+++ b/libcxx/test/containers/associative/multiset/find.pass.cpp
@@ -17,74 +17,150 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
- typedef int V;
- typedef std::multiset<int> M;
{
- typedef M::iterator R;
- V ar[] =
+ typedef int V;
+ typedef std::multiset<int> M;
+ {
+ typedef M::iterator R;
+ V ar[] =
+ {
+ 5,
+ 6,
+ 7,
+ 8,
+ 9,
+ 10,
+ 11,
+ 12
+ };
+ M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.find(5);
+ assert(r == m.begin());
+ r = m.find(6);
+ assert(r == next(m.begin()));
+ r = m.find(7);
+ assert(r == next(m.begin(), 2));
+ r = m.find(8);
+ assert(r == next(m.begin(), 3));
+ r = m.find(9);
+ assert(r == next(m.begin(), 4));
+ r = m.find(10);
+ assert(r == next(m.begin(), 5));
+ r = m.find(11);
+ assert(r == next(m.begin(), 6));
+ r = m.find(12);
+ assert(r == next(m.begin(), 7));
+ r = m.find(4);
+ assert(r == next(m.begin(), 8));
+ }
{
- 5,
- 6,
- 7,
- 8,
- 9,
- 10,
- 11,
- 12
- };
- M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.find(5);
- assert(r == m.begin());
- r = m.find(6);
- assert(r == next(m.begin()));
- r = m.find(7);
- assert(r == next(m.begin(), 2));
- r = m.find(8);
- assert(r == next(m.begin(), 3));
- r = m.find(9);
- assert(r == next(m.begin(), 4));
- r = m.find(10);
- assert(r == next(m.begin(), 5));
- r = m.find(11);
- assert(r == next(m.begin(), 6));
- r = m.find(12);
- assert(r == next(m.begin(), 7));
- r = m.find(4);
- assert(r == next(m.begin(), 8));
+ typedef M::const_iterator R;
+ V ar[] =
+ {
+ 5,
+ 6,
+ 7,
+ 8,
+ 9,
+ 10,
+ 11,
+ 12
+ };
+ const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.find(5);
+ assert(r == m.begin());
+ r = m.find(6);
+ assert(r == next(m.begin()));
+ r = m.find(7);
+ assert(r == next(m.begin(), 2));
+ r = m.find(8);
+ assert(r == next(m.begin(), 3));
+ r = m.find(9);
+ assert(r == next(m.begin(), 4));
+ r = m.find(10);
+ assert(r == next(m.begin(), 5));
+ r = m.find(11);
+ assert(r == next(m.begin(), 6));
+ r = m.find(12);
+ assert(r == next(m.begin(), 7));
+ r = m.find(4);
+ assert(r == next(m.begin(), 8));
+ }
}
+#if __cplusplus >= 201103L
{
- typedef M::const_iterator R;
- V ar[] =
+ typedef int V;
+ typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
+ {
+ typedef M::iterator R;
+ V ar[] =
+ {
+ 5,
+ 6,
+ 7,
+ 8,
+ 9,
+ 10,
+ 11,
+ 12
+ };
+ M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.find(5);
+ assert(r == m.begin());
+ r = m.find(6);
+ assert(r == next(m.begin()));
+ r = m.find(7);
+ assert(r == next(m.begin(), 2));
+ r = m.find(8);
+ assert(r == next(m.begin(), 3));
+ r = m.find(9);
+ assert(r == next(m.begin(), 4));
+ r = m.find(10);
+ assert(r == next(m.begin(), 5));
+ r = m.find(11);
+ assert(r == next(m.begin(), 6));
+ r = m.find(12);
+ assert(r == next(m.begin(), 7));
+ r = m.find(4);
+ assert(r == next(m.begin(), 8));
+ }
{
- 5,
- 6,
- 7,
- 8,
- 9,
- 10,
- 11,
- 12
- };
- const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.find(5);
- assert(r == m.begin());
- r = m.find(6);
- assert(r == next(m.begin()));
- r = m.find(7);
- assert(r == next(m.begin(), 2));
- r = m.find(8);
- assert(r == next(m.begin(), 3));
- r = m.find(9);
- assert(r == next(m.begin(), 4));
- r = m.find(10);
- assert(r == next(m.begin(), 5));
- r = m.find(11);
- assert(r == next(m.begin(), 6));
- r = m.find(12);
- assert(r == next(m.begin(), 7));
- r = m.find(4);
- assert(r == next(m.begin(), 8));
+ typedef M::const_iterator R;
+ V ar[] =
+ {
+ 5,
+ 6,
+ 7,
+ 8,
+ 9,
+ 10,
+ 11,
+ 12
+ };
+ const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.find(5);
+ assert(r == m.begin());
+ r = m.find(6);
+ assert(r == next(m.begin()));
+ r = m.find(7);
+ assert(r == next(m.begin(), 2));
+ r = m.find(8);
+ assert(r == next(m.begin(), 3));
+ r = m.find(9);
+ assert(r == next(m.begin(), 4));
+ r = m.find(10);
+ assert(r == next(m.begin(), 5));
+ r = m.find(11);
+ assert(r == next(m.begin(), 6));
+ r = m.find(12);
+ assert(r == next(m.begin(), 7));
+ r = m.find(4);
+ assert(r == next(m.begin(), 8));
+ }
}
+#endif
}
diff --git a/libcxx/test/containers/associative/multiset/insert_cv.pass.cpp b/libcxx/test/containers/associative/multiset/insert_cv.pass.cpp
index 2673ae74c15..57e1e98f500 100644
--- a/libcxx/test/containers/associative/multiset/insert_cv.pass.cpp
+++ b/libcxx/test/containers/associative/multiset/insert_cv.pass.cpp
@@ -16,6 +16,8 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -42,4 +44,30 @@ int main()
assert(m.size() == 4);
assert(*r == 3);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.insert(M::value_type(2));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(*r == 2);
+
+ r = m.insert(M::value_type(1));
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(*r == 1);
+
+ r = m.insert(M::value_type(3));
+ assert(r == prev(m.end()));
+ assert(m.size() == 3);
+ assert(*r == 3);
+
+ r = m.insert(M::value_type(3));
+ assert(r == prev(m.end()));
+ assert(m.size() == 4);
+ assert(*r == 3);
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/multiset/insert_initializer_list.pass.cpp b/libcxx/test/containers/associative/multiset/insert_initializer_list.pass.cpp
index 4f5691b09bf..c609d242ae2 100644
--- a/libcxx/test/containers/associative/multiset/insert_initializer_list.pass.cpp
+++ b/libcxx/test/containers/associative/multiset/insert_initializer_list.pass.cpp
@@ -16,9 +16,12 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ {
typedef std::multiset<int> C;
typedef C::value_type V;
C m = {10, 8};
@@ -34,5 +37,25 @@ int main()
assert(*++i == V(6));
assert(*++i == V(8));
assert(*++i == V(10));
+ }
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#if __cplusplus >= 201103L
+ {
+ typedef std::multiset<int, std::less<int>, min_allocator<int>> C;
+ typedef C::value_type V;
+ C m = {10, 8};
+ m.insert({1, 2, 3, 4, 5, 6});
+ assert(m.size() == 8);
+ assert(distance(m.begin(), m.end()) == m.size());
+ C::const_iterator i = m.cbegin();
+ assert(*i == V(1));
+ assert(*++i == V(2));
+ assert(*++i == V(3));
+ assert(*++i == V(4));
+ assert(*++i == V(5));
+ assert(*++i == V(6));
+ assert(*++i == V(8));
+ assert(*++i == V(10));
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/multiset/insert_iter_cv.pass.cpp b/libcxx/test/containers/associative/multiset/insert_iter_cv.pass.cpp
index 6e4986292d1..fccc2b71960 100644
--- a/libcxx/test/containers/associative/multiset/insert_iter_cv.pass.cpp
+++ b/libcxx/test/containers/associative/multiset/insert_iter_cv.pass.cpp
@@ -16,6 +16,8 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -42,4 +44,30 @@ int main()
assert(m.size() == 4);
assert(*r == 3);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.insert(m.cend(), M::value_type(2));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(*r == 2);
+
+ r = m.insert(m.cend(), M::value_type(1));
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(*r == 1);
+
+ r = m.insert(m.cend(), M::value_type(3));
+ assert(r == prev(m.end()));
+ assert(m.size() == 3);
+ assert(*r == 3);
+
+ r = m.insert(m.cend(), M::value_type(3));
+ assert(r == prev(m.end()));
+ assert(m.size() == 4);
+ assert(*r == 3);
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/multiset/insert_iter_iter.pass.cpp b/libcxx/test/containers/associative/multiset/insert_iter_iter.pass.cpp
index 231e0c57a6e..3cfa9dd16c4 100644
--- a/libcxx/test/containers/associative/multiset/insert_iter_iter.pass.cpp
+++ b/libcxx/test/containers/associative/multiset/insert_iter_iter.pass.cpp
@@ -18,6 +18,7 @@
#include <cassert>
#include "test_iterators.h"
+#include "../../min_allocator.h"
int main()
{
@@ -50,4 +51,35 @@ int main()
assert(*next(m.begin(), 7) == 3);
assert(*next(m.begin(), 8) == 3);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
+ typedef int V;
+ V ar[] =
+ {
+ 1,
+ 1,
+ 1,
+ 2,
+ 2,
+ 2,
+ 3,
+ 3,
+ 3
+ };
+ M m;
+ m.insert(input_iterator<const V*>(ar),
+ input_iterator<const V*>(ar + sizeof(ar)/sizeof(ar[0])));
+ assert(m.size() == 9);
+ assert(*next(m.begin(), 0) == 1);
+ assert(*next(m.begin(), 1) == 1);
+ assert(*next(m.begin(), 2) == 1);
+ assert(*next(m.begin(), 3) == 2);
+ assert(*next(m.begin(), 4) == 2);
+ assert(*next(m.begin(), 5) == 2);
+ assert(*next(m.begin(), 6) == 3);
+ assert(*next(m.begin(), 7) == 3);
+ assert(*next(m.begin(), 8) == 3);
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/multiset/insert_iter_rv.pass.cpp b/libcxx/test/containers/associative/multiset/insert_iter_rv.pass.cpp
index 3700dd18888..f09d97de827 100644
--- a/libcxx/test/containers/associative/multiset/insert_iter_rv.pass.cpp
+++ b/libcxx/test/containers/associative/multiset/insert_iter_rv.pass.cpp
@@ -17,6 +17,7 @@
#include <cassert>
#include "../../MoveOnly.h"
+#include "../../min_allocator.h"
int main()
{
@@ -46,4 +47,30 @@ int main()
assert(*r == 3);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if __cplusplus >= 201103L
+ {
+ typedef std::multiset<MoveOnly, std::less<MoveOnly>, min_allocator<MoveOnly>> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.insert(m.cend(), M::value_type(2));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(*r == 2);
+
+ r = m.insert(m.cend(), M::value_type(1));
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(*r == 1);
+
+ r = m.insert(m.cend(), M::value_type(3));
+ assert(r == prev(m.end()));
+ assert(m.size() == 3);
+ assert(*r == 3);
+
+ r = m.insert(m.cend(), M::value_type(3));
+ assert(r == prev(m.end()));
+ assert(m.size() == 4);
+ assert(*r == 3);
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/multiset/insert_rv.pass.cpp b/libcxx/test/containers/associative/multiset/insert_rv.pass.cpp
index a65b67a9533..e9e773ccd73 100644
--- a/libcxx/test/containers/associative/multiset/insert_rv.pass.cpp
+++ b/libcxx/test/containers/associative/multiset/insert_rv.pass.cpp
@@ -17,6 +17,7 @@
#include <cassert>
#include "../../MoveOnly.h"
+#include "../../min_allocator.h"
int main()
{
@@ -46,4 +47,30 @@ int main()
assert(*r == 3);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if __cplusplus >= 201103L
+ {
+ typedef std::multiset<MoveOnly, std::less<MoveOnly>, min_allocator<MoveOnly>> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.insert(M::value_type(2));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(*r == 2);
+
+ r = m.insert(M::value_type(1));
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(*r == 1);
+
+ r = m.insert(M::value_type(3));
+ assert(r == prev(m.end()));
+ assert(m.size() == 3);
+ assert(*r == 3);
+
+ r = m.insert(M::value_type(3));
+ assert(r == prev(m.end()));
+ assert(m.size() == 4);
+ assert(*r == 3);
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/multiset/iterator.pass.cpp b/libcxx/test/containers/associative/multiset/iterator.pass.cpp
index 1b202191b3d..2a7b209e9c0 100644
--- a/libcxx/test/containers/associative/multiset/iterator.pass.cpp
+++ b/libcxx/test/containers/associative/multiset/iterator.pass.cpp
@@ -29,6 +29,8 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -105,10 +107,92 @@ int main()
assert(std::distance(m.cbegin(), m.cend()) == m.size());
assert(std::distance(m.rbegin(), m.rend()) == m.size());
assert(std::distance(m.crbegin(), m.crend()) == m.size());
- std::multiset<int, double>::const_iterator i;
+ std::multiset<int>::const_iterator i;
+ i = m.begin();
+ for (int j = 1; j <= 8; ++j)
+ for (int k = 0; k < 3; ++k, ++i)
+ assert(*i == j);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef int V;
+ V ar[] =
+ {
+ 1,
+ 1,
+ 1,
+ 2,
+ 2,
+ 2,
+ 3,
+ 3,
+ 3,
+ 4,
+ 4,
+ 4,
+ 5,
+ 5,
+ 5,
+ 6,
+ 6,
+ 6,
+ 7,
+ 7,
+ 7,
+ 8,
+ 8,
+ 8
+ };
+ std::multiset<int, std::less<int>, min_allocator<int>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ assert(std::distance(m.begin(), m.end()) == m.size());
+ assert(std::distance(m.rbegin(), m.rend()) == m.size());
+ std::multiset<int, std::less<int>, min_allocator<int>>::iterator i;
+ i = m.begin();
+ std::multiset<int, std::less<int>, min_allocator<int>>::const_iterator k = i;
+ assert(i == k);
+ for (int j = 1; j <= 8; ++j)
+ for (int k = 0; k < 3; ++k, ++i)
+ assert(*i == j);
+ }
+ {
+ typedef int V;
+ V ar[] =
+ {
+ 1,
+ 1,
+ 1,
+ 2,
+ 2,
+ 2,
+ 3,
+ 3,
+ 3,
+ 4,
+ 4,
+ 4,
+ 5,
+ 5,
+ 5,
+ 6,
+ 6,
+ 6,
+ 7,
+ 7,
+ 7,
+ 8,
+ 8,
+ 8
+ };
+ const std::multiset<int, std::less<int>, min_allocator<int>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ assert(std::distance(m.begin(), m.end()) == m.size());
+ assert(std::distance(m.cbegin(), m.cend()) == m.size());
+ assert(std::distance(m.rbegin(), m.rend()) == m.size());
+ assert(std::distance(m.crbegin(), m.crend()) == m.size());
+ std::multiset<int, std::less<int>, min_allocator<int>>::const_iterator i;
i = m.begin();
for (int j = 1; j <= 8; ++j)
for (int k = 0; k < 3; ++k, ++i)
assert(*i == j);
}
+#endif
}
diff --git a/libcxx/test/containers/associative/multiset/lower_bound.pass.cpp b/libcxx/test/containers/associative/multiset/lower_bound.pass.cpp
index 585c341cd23..537ccd3aff1 100644
--- a/libcxx/test/containers/associative/multiset/lower_bound.pass.cpp
+++ b/libcxx/test/containers/associative/multiset/lower_bound.pass.cpp
@@ -17,68 +17,138 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
- typedef int V;
- typedef std::multiset<int> M;
{
- typedef M::iterator R;
- V ar[] =
+ typedef int V;
+ typedef std::multiset<int> M;
+ {
+ typedef M::iterator R;
+ V ar[] =
+ {
+ 5,
+ 5,
+ 5,
+ 7,
+ 7,
+ 7,
+ 9,
+ 9,
+ 9
+ };
+ M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.lower_bound(4);
+ assert(r == next(m.begin(), 0));
+ r = m.lower_bound(5);
+ assert(r == next(m.begin(), 0));
+ r = m.lower_bound(6);
+ assert(r == next(m.begin(), 3));
+ r = m.lower_bound(7);
+ assert(r == next(m.begin(), 3));
+ r = m.lower_bound(8);
+ assert(r == next(m.begin(), 6));
+ r = m.lower_bound(9);
+ assert(r == next(m.begin(), 6));
+ r = m.lower_bound(11);
+ assert(r == next(m.begin(), 9));
+ }
{
- 5,
- 5,
- 5,
- 7,
- 7,
- 7,
- 9,
- 9,
- 9
- };
- M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.lower_bound(4);
- assert(r == next(m.begin(), 0));
- r = m.lower_bound(5);
- assert(r == next(m.begin(), 0));
- r = m.lower_bound(6);
- assert(r == next(m.begin(), 3));
- r = m.lower_bound(7);
- assert(r == next(m.begin(), 3));
- r = m.lower_bound(8);
- assert(r == next(m.begin(), 6));
- r = m.lower_bound(9);
- assert(r == next(m.begin(), 6));
- r = m.lower_bound(11);
- assert(r == next(m.begin(), 9));
+ typedef M::const_iterator R;
+ V ar[] =
+ {
+ 5,
+ 5,
+ 5,
+ 7,
+ 7,
+ 7,
+ 9,
+ 9,
+ 9
+ };
+ const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.lower_bound(4);
+ assert(r == next(m.begin(), 0));
+ r = m.lower_bound(5);
+ assert(r == next(m.begin(), 0));
+ r = m.lower_bound(6);
+ assert(r == next(m.begin(), 3));
+ r = m.lower_bound(7);
+ assert(r == next(m.begin(), 3));
+ r = m.lower_bound(8);
+ assert(r == next(m.begin(), 6));
+ r = m.lower_bound(9);
+ assert(r == next(m.begin(), 6));
+ r = m.lower_bound(11);
+ assert(r == next(m.begin(), 9));
+ }
}
+#if __cplusplus >= 201103L
{
- typedef M::const_iterator R;
- V ar[] =
+ typedef int V;
+ typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
+ {
+ typedef M::iterator R;
+ V ar[] =
+ {
+ 5,
+ 5,
+ 5,
+ 7,
+ 7,
+ 7,
+ 9,
+ 9,
+ 9
+ };
+ M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.lower_bound(4);
+ assert(r == next(m.begin(), 0));
+ r = m.lower_bound(5);
+ assert(r == next(m.begin(), 0));
+ r = m.lower_bound(6);
+ assert(r == next(m.begin(), 3));
+ r = m.lower_bound(7);
+ assert(r == next(m.begin(), 3));
+ r = m.lower_bound(8);
+ assert(r == next(m.begin(), 6));
+ r = m.lower_bound(9);
+ assert(r == next(m.begin(), 6));
+ r = m.lower_bound(11);
+ assert(r == next(m.begin(), 9));
+ }
{
- 5,
- 5,
- 5,
- 7,
- 7,
- 7,
- 9,
- 9,
- 9
- };
- const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- R r = m.lower_bound(4);
- assert(r == next(m.begin(), 0));
- r = m.lower_bound(5);
- assert(r == next(m.begin(), 0));
- r = m.lower_bound(6);
- assert(r == next(m.begin(), 3));
- r = m.lower_bound(7);
- assert(r == next(m.begin(), 3));
- r = m.lower_bound(8);
- assert(r == next(m.begin(), 6));
- r = m.lower_bound(9);
- assert(r == next(m.begin(), 6));
- r = m.lower_bound(11);
- assert(r == next(m.begin(), 9));
+ typedef M::const_iterator R;
+ V ar[] =
+ {
+ 5,
+ 5,
+ 5,
+ 7,
+ 7,
+ 7,
+ 9,
+ 9,
+ 9
+ };
+ const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.lower_bound(4);
+ assert(r == next(m.begin(), 0));
+ r = m.lower_bound(5);
+ assert(r == next(m.begin(), 0));
+ r = m.lower_bound(6);
+ assert(r == next(m.begin(), 3));
+ r = m.lower_bound(7);
+ assert(r == next(m.begin(), 3));
+ r = m.lower_bound(8);
+ assert(r == next(m.begin(), 6));
+ r = m.lower_bound(9);
+ assert(r == next(m.begin(), 6));
+ r = m.lower_bound(11);
+ assert(r == next(m.begin(), 9));
+ }
}
+#endif
}
diff --git a/libcxx/test/containers/associative/multiset/max_size.pass.cpp b/libcxx/test/containers/associative/multiset/max_size.pass.cpp
index cf3581ef5dc..a209d700ee6 100644
--- a/libcxx/test/containers/associative/multiset/max_size.pass.cpp
+++ b/libcxx/test/containers/associative/multiset/max_size.pass.cpp
@@ -16,9 +16,20 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
+ {
typedef std::multiset<int> M;
M m;
assert(m.max_size() != 0);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
+ M m;
+ assert(m.max_size() != 0);
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/multiset/multiset.cons/assign_initializer_list.pass.cpp b/libcxx/test/containers/associative/multiset/multiset.cons/assign_initializer_list.pass.cpp
index a6834afe0db..16ba28abfca 100644
--- a/libcxx/test/containers/associative/multiset/multiset.cons/assign_initializer_list.pass.cpp
+++ b/libcxx/test/containers/associative/multiset/multiset.cons/assign_initializer_list.pass.cpp
@@ -16,9 +16,12 @@
#include <set>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ {
typedef std::multiset<int> C;
typedef C::value_type V;
C m = {10, 8};
@@ -32,5 +35,23 @@ int main()
assert(*++i == V(4));
assert(*++i == V(5));
assert(*++i == V(6));
+ }
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#if __cplusplus >= 201103L
+ {
+ typedef std::multiset<int, std::less<int>, min_allocator<int>> C;
+ typedef C::value_type V;
+ C m = {10, 8};
+ m = {1, 2, 3, 4, 5, 6};
+ assert(m.size() == 6);
+ assert(distance(m.begin(), m.end()) == 6);
+ C::const_iterator i = m.cbegin();
+ assert(*i == V(1));
+ assert(*++i == V(2));
+ assert(*++i == V(3));
+ assert(*++i == V(4));
+ assert(*++i == V(5));
+ assert(*++i == V(6));
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/multiset/multiset.cons/default.pass.cpp b/libcxx/test/containers/associative/multiset/multiset.cons/default.pass.cpp
index 72fd822f745..cf24bf771ce 100644
--- a/libcxx/test/containers/associative/multiset/multiset.cons/default.pass.cpp
+++ b/libcxx/test/containers/associative/multiset/multiset.cons/default.pass.cpp
@@ -16,9 +16,20 @@
#include <set>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
+ {
std::multiset<int> m;
assert(m.empty());
assert(m.begin() == m.end());
+ }
+#if __cplusplus >= 201103L
+ {
+ std::multiset<int, std::less<int>, min_allocator<int>> m;
+ assert(m.empty());
+ assert(m.begin() == m.end());
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/multiset/multiset.cons/initializer_list.pass.cpp b/libcxx/test/containers/associative/multiset/multiset.cons/initializer_list.pass.cpp
index 4ee2b4daa54..9e3186d9233 100644
--- a/libcxx/test/containers/associative/multiset/multiset.cons/initializer_list.pass.cpp
+++ b/libcxx/test/containers/associative/multiset/multiset.cons/initializer_list.pass.cpp
@@ -16,9 +16,12 @@
#include <set>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ {
typedef std::multiset<int> C;
typedef C::value_type V;
C m = {1, 2, 3, 4, 5, 6};
@@ -31,5 +34,22 @@ int main()
assert(*++i == V(4));
assert(*++i == V(5));
assert(*++i == V(6));
+ }
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#if __cplusplus >= 201103L
+ {
+ typedef std::multiset<int, std::less<int>, min_allocator<int>> C;
+ typedef C::value_type V;
+ C m = {1, 2, 3, 4, 5, 6};
+ assert(m.size() == 6);
+ assert(distance(m.begin(), m.end()) == 6);
+ C::const_iterator i = m.cbegin();
+ assert(*i == V(1));
+ assert(*++i == V(2));
+ assert(*++i == V(3));
+ assert(*++i == V(4));
+ assert(*++i == V(5));
+ assert(*++i == V(6));
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/multiset/multiset.cons/iter_iter.pass.cpp b/libcxx/test/containers/associative/multiset/multiset.cons/iter_iter.pass.cpp
index d8a3c145370..3f0053996f3 100644
--- a/libcxx/test/containers/associative/multiset/multiset.cons/iter_iter.pass.cpp
+++ b/libcxx/test/containers/associative/multiset/multiset.cons/iter_iter.pass.cpp
@@ -18,9 +18,11 @@
#include <cassert>
#include "test_iterators.h"
+#include "../../../min_allocator.h"
int main()
{
+ {
typedef int V;
V ar[] =
{
@@ -47,4 +49,35 @@ int main()
assert(*next(m.begin(), 6) == 3);
assert(*next(m.begin(), 7) == 3);
assert(*next(m.begin(), 8) == 3);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef int V;
+ V ar[] =
+ {
+ 1,
+ 1,
+ 1,
+ 2,
+ 2,
+ 2,
+ 3,
+ 3,
+ 3
+ };
+ std::multiset<V, std::less<V>, min_allocator<V>> m(input_iterator<const int*>(ar),
+ input_iterator<const int*>(ar+sizeof(ar)/sizeof(ar[0])));
+ assert(m.size() == 9);
+ assert(distance(m.begin(), m.end()) == 9);
+ assert(*next(m.begin(), 0) == 1);
+ assert(*next(m.begin(), 1) == 1);
+ assert(*next(m.begin(), 2) == 1);
+ assert(*next(m.begin(), 3) == 2);
+ assert(*next(m.begin(), 4) == 2);
+ assert(*next(m.begin(), 5) == 2);
+ assert(*next(m.begin(), 6) == 3);
+ assert(*next(m.begin(), 7) == 3);
+ assert(*next(m.begin(), 8) == 3);
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/multiset/multiset.cons/move.pass.cpp b/libcxx/test/containers/associative/multiset/multiset.cons/move.pass.cpp
index dee53d98df6..97f593bb32b 100644
--- a/libcxx/test/containers/associative/multiset/multiset.cons/move.pass.cpp
+++ b/libcxx/test/containers/associative/multiset/multiset.cons/move.pass.cpp
@@ -18,6 +18,7 @@
#include "../../../test_compare.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -76,4 +77,43 @@ int main()
assert(distance(mo.begin(), mo.end()) == 0);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if __cplusplus >= 201103L
+ {
+ typedef int V;
+ V ar[] =
+ {
+ 1,
+ 1,
+ 1,
+ 2,
+ 2,
+ 2,
+ 3,
+ 3,
+ 3
+ };
+ typedef test_compare<std::less<int> > C;
+ typedef min_allocator<V> A;
+ std::multiset<int, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A());
+ std::multiset<int, C, A> m = std::move(mo);
+ assert(m.get_allocator() == A());
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 9);
+ assert(distance(m.begin(), m.end()) == 9);
+ assert(*next(m.begin(), 0) == 1);
+ assert(*next(m.begin(), 1) == 1);
+ assert(*next(m.begin(), 2) == 1);
+ assert(*next(m.begin(), 3) == 2);
+ assert(*next(m.begin(), 4) == 2);
+ assert(*next(m.begin(), 5) == 2);
+ assert(*next(m.begin(), 6) == 3);
+ assert(*next(m.begin(), 7) == 3);
+ assert(*next(m.begin(), 8) == 3);
+
+ assert(mo.get_allocator() == A());
+ assert(mo.key_comp() == C(5));
+ assert(mo.size() == 0);
+ assert(distance(mo.begin(), mo.end()) == 0);
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/multiset/multiset.cons/move_assign.pass.cpp b/libcxx/test/containers/associative/multiset/multiset.cons/move_assign.pass.cpp
index f17d29bb493..e02942ffeea 100644
--- a/libcxx/test/containers/associative/multiset/multiset.cons/move_assign.pass.cpp
+++ b/libcxx/test/containers/associative/multiset/multiset.cons/move_assign.pass.cpp
@@ -19,6 +19,7 @@
#include "../../../MoveOnly.h"
#include "../../../test_compare.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -141,4 +142,45 @@ int main()
assert(m1.empty());
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if __cplusplus >= 201103L
+ {
+ typedef MoveOnly V;
+ typedef test_compare<std::less<MoveOnly> > C;
+ typedef min_allocator<V> A;
+ typedef std::multiset<MoveOnly, C, A> M;
+ typedef std::move_iterator<V*> I;
+ V a1[] =
+ {
+ V(1),
+ V(1),
+ V(1),
+ V(2),
+ V(2),
+ V(2),
+ V(3),
+ V(3),
+ V(3)
+ };
+ M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A());
+ V a2[] =
+ {
+ V(1),
+ V(1),
+ V(1),
+ V(2),
+ V(2),
+ V(2),
+ V(3),
+ V(3),
+ V(3)
+ };
+ M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A());
+ M m3(C(3), A());
+ m3 = std::move(m1);
+ assert(m3 == m2);
+ assert(m3.get_allocator() == A());
+ assert(m3.key_comp() == C(5));
+ assert(m1.empty());
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/multiset/multiset.special/member_swap.pass.cpp b/libcxx/test/containers/associative/multiset/multiset.special/member_swap.pass.cpp
index db6ab15a5bc..8d5b1e822bc 100644
--- a/libcxx/test/containers/associative/multiset/multiset.special/member_swap.pass.cpp
+++ b/libcxx/test/containers/associative/multiset/multiset.special/member_swap.pass.cpp
@@ -16,8 +16,11 @@
#include <set>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
+ {
typedef int V;
typedef std::multiset<int> M;
{
@@ -104,4 +107,95 @@ int main()
assert(m1 == m2_save);
assert(m2 == m1_save);
}
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef int V;
+ typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
+ {
+ V ar1[] =
+ {
+ };
+ V ar2[] =
+ {
+ };
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ }
+ {
+ V ar1[] =
+ {
+ };
+ V ar2[] =
+ {
+ 5,
+ 6,
+ 7,
+ 8,
+ 9,
+ 10,
+ 11,
+ 12
+ };
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ }
+ {
+ V ar1[] =
+ {
+ 1,
+ 2,
+ 3,
+ 4
+ };
+ V ar2[] =
+ {
+ };
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ }
+ {
+ V ar1[] =
+ {
+ 1,
+ 2,
+ 3,
+ 4
+ };
+ V ar2[] =
+ {
+ 5,
+ 6,
+ 7,
+ 8,
+ 9,
+ 10,
+ 11,
+ 12
+ };
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ }
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/multiset/size.pass.cpp b/libcxx/test/containers/associative/multiset/size.pass.cpp
index f7b12388ce8..8129a9c3675 100644
--- a/libcxx/test/containers/associative/multiset/size.pass.cpp
+++ b/libcxx/test/containers/associative/multiset/size.pass.cpp
@@ -16,8 +16,11 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
+ {
typedef std::multiset<int> M;
M m;
assert(m.size() == 0);
@@ -33,4 +36,24 @@ int main()
assert(m.size() == 1);
m.erase(m.begin());
assert(m.size() == 0);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
+ M m;
+ assert(m.size() == 0);
+ m.insert(M::value_type(2));
+ assert(m.size() == 1);
+ m.insert(M::value_type(1));
+ assert(m.size() == 2);
+ m.insert(M::value_type(2));
+ assert(m.size() == 3);
+ m.erase(m.begin());
+ assert(m.size() == 2);
+ m.erase(m.begin());
+ assert(m.size() == 1);
+ m.erase(m.begin());
+ assert(m.size() == 0);
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/multiset/types.pass.cpp b/libcxx/test/containers/associative/multiset/types.pass.cpp
index de5ee694fa4..e3331cddc6d 100644
--- a/libcxx/test/containers/associative/multiset/types.pass.cpp
+++ b/libcxx/test/containers/associative/multiset/types.pass.cpp
@@ -32,8 +32,11 @@
#include <set>
#include <type_traits>
+#include "../../min_allocator.h"
+
int main()
{
+ {
static_assert((std::is_same<std::multiset<int>::key_type, int>::value), "");
static_assert((std::is_same<std::multiset<int>::value_type, int>::value), "");
static_assert((std::is_same<std::multiset<int>::key_compare, std::less<int> >::value), "");
@@ -45,4 +48,20 @@ int main()
static_assert((std::is_same<std::multiset<int>::const_pointer, const int*>::value), "");
static_assert((std::is_same<std::multiset<int>::size_type, std::size_t>::value), "");
static_assert((std::is_same<std::multiset<int>::difference_type, std::ptrdiff_t>::value), "");
+ }
+#if __cplusplus >= 201103L
+ {
+ static_assert((std::is_same<std::multiset<int, std::less<int>, min_allocator<int>>::key_type, int>::value), "");
+ static_assert((std::is_same<std::multiset<int, std::less<int>, min_allocator<int>>::value_type, int>::value), "");
+ static_assert((std::is_same<std::multiset<int, std::less<int>, min_allocator<int>>::key_compare, std::less<int> >::value), "");
+ static_assert((std::is_same<std::multiset<int, std::less<int>, min_allocator<int>>::value_compare, std::less<int> >::value), "");
+ static_assert((std::is_same<std::multiset<int, std::less<int>, min_allocator<int>>::allocator_type, min_allocator<int>>::value), "");
+ static_assert((std::is_same<std::multiset<int, std::less<int>, min_allocator<int>>::reference, int&>::value), "");
+ static_assert((std::is_same<std::multiset<int, std::less<int>, min_allocator<int>>::const_reference, const int&>::value), "");
+ static_assert((std::is_same<std::multiset<int, std::less<int>, min_allocator<int>>::pointer, min_pointer<int>>::value), "");
+ static_assert((std::is_same<std::multiset<int, std::less<int>, min_allocator<int>>::const_pointer, min_pointer<const int>>::value), "");
+ static_assert((std::is_same<std::multiset<int, std::less<int>, min_allocator<int>>::size_type, std::size_t>::value), "");
+ static_assert((std::is_same<std::multiset<int, std::less<int>, min_allocator<int>>::difference_type, std::ptrdiff_t>::value), "");
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/multiset/upper_bound.pass.cpp b/libcxx/test/containers/associative/multiset/upper_bound.pass.cpp
index 592a3fcd82b..332254eef68 100644
--- a/libcxx/test/containers/associative/multiset/upper_bound.pass.cpp
+++ b/libcxx/test/containers/associative/multiset/upper_bound.pass.cpp
@@ -17,8 +17,11 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
+ {
typedef int V;
typedef std::multiset<int> M;
{
@@ -81,4 +84,71 @@ int main()
r = m.upper_bound(11);
assert(r == next(m.begin(), 9));
}
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef int V;
+ typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
+ {
+ typedef M::iterator R;
+ V ar[] =
+ {
+ 5,
+ 5,
+ 5,
+ 7,
+ 7,
+ 7,
+ 9,
+ 9,
+ 9
+ };
+ M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.upper_bound(4);
+ assert(r == next(m.begin(), 0));
+ r = m.upper_bound(5);
+ assert(r == next(m.begin(), 3));
+ r = m.upper_bound(6);
+ assert(r == next(m.begin(), 3));
+ r = m.upper_bound(7);
+ assert(r == next(m.begin(), 6));
+ r = m.upper_bound(8);
+ assert(r == next(m.begin(), 6));
+ r = m.upper_bound(9);
+ assert(r == next(m.begin(), 9));
+ r = m.upper_bound(11);
+ assert(r == next(m.begin(), 9));
+ }
+ {
+ typedef M::const_iterator R;
+ V ar[] =
+ {
+ 5,
+ 5,
+ 5,
+ 7,
+ 7,
+ 7,
+ 9,
+ 9,
+ 9
+ };
+ const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.upper_bound(4);
+ assert(r == next(m.begin(), 0));
+ r = m.upper_bound(5);
+ assert(r == next(m.begin(), 3));
+ r = m.upper_bound(6);
+ assert(r == next(m.begin(), 3));
+ r = m.upper_bound(7);
+ assert(r == next(m.begin(), 6));
+ r = m.upper_bound(8);
+ assert(r == next(m.begin(), 6));
+ r = m.upper_bound(9);
+ assert(r == next(m.begin(), 9));
+ r = m.upper_bound(11);
+ assert(r == next(m.begin(), 9));
+ }
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/set/clear.pass.cpp b/libcxx/test/containers/associative/set/clear.pass.cpp
index aa632c7f1d9..c6e01023f65 100644
--- a/libcxx/test/containers/associative/set/clear.pass.cpp
+++ b/libcxx/test/containers/associative/set/clear.pass.cpp
@@ -16,6 +16,8 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -37,4 +39,25 @@ int main()
m.clear();
assert(m.size() == 0);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::set<int, std::less<int>, min_allocator<int>> M;
+ typedef int V;
+ V ar[] =
+ {
+ 1,
+ 2,
+ 3,
+ 4,
+ 5,
+ 6,
+ 7,
+ 8
+ };
+ M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
+ assert(m.size() == 8);
+ m.clear();
+ assert(m.size() == 0);
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/set/count.pass.cpp b/libcxx/test/containers/associative/set/count.pass.cpp
index 4a678a198a7..7d7a31ad0db 100644
--- a/libcxx/test/containers/associative/set/count.pass.cpp
+++ b/libcxx/test/containers/associative/set/count.pass.cpp
@@ -16,11 +16,49 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
- typedef int V;
- typedef std::set<int> M;
{
+ typedef int V;
+ typedef std::set<int> M;
+ typedef M::size_type R;
+ V ar[] =
+ {
+ 5,
+ 6,
+ 7,
+ 8,
+ 9,
+ 10,
+ 11,
+ 12
+ };
+ const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.count(5);
+ assert(r == 1);
+ r = m.count(6);
+ assert(r == 1);
+ r = m.count(7);
+ assert(r == 1);
+ r = m.count(8);
+ assert(r == 1);
+ r = m.count(9);
+ assert(r == 1);
+ r = m.count(10);
+ assert(r == 1);
+ r = m.count(11);
+ assert(r == 1);
+ r = m.count(12);
+ assert(r == 1);
+ r = m.count(4);
+ assert(r == 0);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef int V;
+ typedef std::set<int, std::less<int>, min_allocator<int>> M;
typedef M::size_type R;
V ar[] =
{
@@ -53,4 +91,5 @@ int main()
r = m.count(4);
assert(r == 0);
}
+#endif
}
diff --git a/libcxx/test/containers/associative/set/emplace.pass.cpp b/libcxx/test/containers/associative/set/emplace.pass.cpp
index e322ff1df6a..69fdbeeb6b2 100644
--- a/libcxx/test/containers/associative/set/emplace.pass.cpp
+++ b/libcxx/test/containers/associative/set/emplace.pass.cpp
@@ -19,6 +19,7 @@
#include "../../Emplaceable.h"
#include "../../DefaultOnly.h"
+#include "../../min_allocator.h"
int main()
{
@@ -73,5 +74,17 @@ int main()
assert(m.size() == 1);
assert(*r.first == 2);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::set<int, std::less<int>, min_allocator<int>> M;
+ typedef std::pair<M::iterator, bool> R;
+ M m;
+ R r = m.emplace(M::value_type(2));
+ assert(r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 1);
+ assert(*r.first == 2);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/libcxx/test/containers/associative/set/emplace_hint.pass.cpp b/libcxx/test/containers/associative/set/emplace_hint.pass.cpp
index be5d73dac93..8e7fbbc4033 100644
--- a/libcxx/test/containers/associative/set/emplace_hint.pass.cpp
+++ b/libcxx/test/containers/associative/set/emplace_hint.pass.cpp
@@ -19,6 +19,7 @@
#include "../../Emplaceable.h"
#include "../../DefaultOnly.h"
+#include "../../min_allocator.h"
int main()
{
@@ -67,5 +68,16 @@ int main()
assert(m.size() == 1);
assert(*r == 2);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::set<int, std::less<int>, min_allocator<int>> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.emplace_hint(m.cend(), M::value_type(2));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(*r == 2);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/libcxx/test/containers/associative/set/empty.pass.cpp b/libcxx/test/containers/associative/set/empty.pass.cpp
index 615bc61dd44..305ae39ff90 100644
--- a/libcxx/test/containers/associative/set/empty.pass.cpp
+++ b/libcxx/test/containers/associative/set/empty.pass.cpp
@@ -16,8 +16,11 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
+ {
typedef std::set<int> M;
M m;
assert(m.empty());
@@ -25,4 +28,16 @@ int main()
assert(!m.empty());
m.clear();
assert(m.empty());
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::set<int, std::less<int>, min_allocator<int>> M;
+ M m;
+ assert(m.empty());
+ m.insert(M::value_type(1));
+ assert(!m.empty());
+ m.clear();
+ assert(m.empty());
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/set/equal_range.pass.cpp b/libcxx/test/containers/associative/set/equal_range.pass.cpp
index 7b17a471371..95a933ef436 100644
--- a/libcxx/test/containers/associative/set/equal_range.pass.cpp
+++ b/libcxx/test/containers/associative/set/equal_range.pass.cpp
@@ -17,8 +17,11 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
+ {
typedef int V;
typedef std::set<int> M;
{
@@ -153,4 +156,75 @@ int main()
assert(r.first == next(m.begin(), 8));
assert(r.second == next(m.begin(), 8));
}
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef int V;
+ typedef std::set<int, std::less<int>, min_allocator<int>> M;
+ typedef std::pair<M::iterator, M::iterator> R;
+ V ar[] =
+ {
+ 5,
+ 7,
+ 9,
+ 11,
+ 13,
+ 15,
+ 17,
+ 19
+ };
+ M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.equal_range(5);
+ assert(r.first == next(m.begin(), 0));
+ assert(r.second == next(m.begin(), 1));
+ r = m.equal_range(7);
+ assert(r.first == next(m.begin(), 1));
+ assert(r.second == next(m.begin(), 2));
+ r = m.equal_range(9);
+ assert(r.first == next(m.begin(), 2));
+ assert(r.second == next(m.begin(), 3));
+ r = m.equal_range(11);
+ assert(r.first == next(m.begin(), 3));
+ assert(r.second == next(m.begin(), 4));
+ r = m.equal_range(13);
+ assert(r.first == next(m.begin(), 4));
+ assert(r.second == next(m.begin(), 5));
+ r = m.equal_range(15);
+ assert(r.first == next(m.begin(), 5));
+ assert(r.second == next(m.begin(), 6));
+ r = m.equal_range(17);
+ assert(r.first == next(m.begin(), 6));
+ assert(r.second == next(m.begin(), 7));
+ r = m.equal_range(19);
+ assert(r.first == next(m.begin(), 7));
+ assert(r.second == next(m.begin(), 8));
+ r = m.equal_range(4);
+ assert(r.first == next(m.begin(), 0));
+ assert(r.second == next(m.begin(), 0));
+ r = m.equal_range(6);
+ assert(r.first == next(m.begin(), 1));
+ assert(r.second == next(m.begin(), 1));
+ r = m.equal_range(8);
+ assert(r.first == next(m.begin(), 2));
+ assert(r.second == next(m.begin(), 2));
+ r = m.equal_range(10);
+ assert(r.first == next(m.begin(), 3));
+ assert(r.second == next(m.begin(), 3));
+ r = m.equal_range(12);
+ assert(r.first == next(m.begin(), 4));
+ assert(r.second == next(m.begin(), 4));
+ r = m.equal_range(14);
+ assert(r.first == next(m.begin(), 5));
+ assert(r.second == next(m.begin(), 5));
+ r = m.equal_range(16);
+ assert(r.first == next(m.begin(), 6));
+ assert(r.second == next(m.begin(), 6));
+ r = m.equal_range(18);
+ assert(r.first == next(m.begin(), 7));
+ assert(r.second == next(m.begin(), 7));
+ r = m.equal_range(20);
+ assert(r.first == next(m.begin(), 8));
+ assert(r.second == next(m.begin(), 8));
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/set/erase_iter.pass.cpp b/libcxx/test/containers/associative/set/erase_iter.pass.cpp
index 949e973961d..f05d4819e07 100644
--- a/libcxx/test/containers/associative/set/erase_iter.pass.cpp
+++ b/libcxx/test/containers/associative/set/erase_iter.pass.cpp
@@ -16,6 +16,8 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -96,4 +98,84 @@ int main()
assert(i == m.begin());
assert(i == m.end());
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::set<int, std::less<int>, min_allocator<int>> M;
+ typedef int V;
+ typedef M::iterator I;
+ V ar[] =
+ {
+ 1,
+ 2,
+ 3,
+ 4,
+ 5,
+ 6,
+ 7,
+ 8
+ };
+ M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
+ assert(m.size() == 8);
+ I i = m.erase(next(m.cbegin(), 3));
+ assert(m.size() == 7);
+ assert(i == next(m.begin(), 3));
+ assert(*next(m.begin(), 0) == 1);
+ assert(*next(m.begin(), 1) == 2);
+ assert(*next(m.begin(), 2) == 3);
+ assert(*next(m.begin(), 3) == 5);
+ assert(*next(m.begin(), 4) == 6);
+ assert(*next(m.begin(), 5) == 7);
+ assert(*next(m.begin(), 6) == 8);
+
+ i = m.erase(next(m.cbegin(), 0));
+ assert(m.size() == 6);
+ assert(i == m.begin());
+ assert(*next(m.begin(), 0) == 2);
+ assert(*next(m.begin(), 1) == 3);
+ assert(*next(m.begin(), 2) == 5);
+ assert(*next(m.begin(), 3) == 6);
+ assert(*next(m.begin(), 4) == 7);
+ assert(*next(m.begin(), 5) == 8);
+
+ i = m.erase(next(m.cbegin(), 5));
+ assert(m.size() == 5);
+ assert(i == m.end());
+ assert(*next(m.begin(), 0) == 2);
+ assert(*next(m.begin(), 1) == 3);
+ assert(*next(m.begin(), 2) == 5);
+ assert(*next(m.begin(), 3) == 6);
+ assert(*next(m.begin(), 4) == 7);
+
+ i = m.erase(next(m.cbegin(), 1));
+ assert(m.size() == 4);
+ assert(i == next(m.begin()));
+ assert(*next(m.begin(), 0) == 2);
+ assert(*next(m.begin(), 1) == 5);
+ assert(*next(m.begin(), 2) == 6);
+ assert(*next(m.begin(), 3) == 7);
+
+ i = m.erase(next(m.cbegin(), 2));
+ assert(m.size() == 3);
+ assert(i == next(m.begin(), 2));
+ assert(*next(m.begin(), 0) == 2);
+ assert(*next(m.begin(), 1) == 5);
+ assert(*next(m.begin(), 2) == 7);
+
+ i = m.erase(next(m.cbegin(), 2));
+ assert(m.size() == 2);
+ assert(i == next(m.begin(), 2));
+ assert(*next(m.begin(), 0) == 2);
+ assert(*next(m.begin(), 1) == 5);
+
+ i = m.erase(next(m.cbegin(), 0));
+ assert(m.size() == 1);
+ assert(i == next(m.begin(), 0));
+ assert(*next(m.begin(), 0) == 5);
+
+ i = m.erase(m.cbegin());
+ assert(m.size() == 0);
+ assert(i == m.begin());
+ assert(i == m.end());
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/set/erase_iter_iter.pass.cpp b/libcxx/test/containers/associative/set/erase_iter_iter.pass.cpp
index 283b8b57a2f..953d1be8bd4 100644
--- a/libcxx/test/containers/associative/set/erase_iter_iter.pass.cpp
+++ b/libcxx/test/containers/associative/set/erase_iter_iter.pass.cpp
@@ -16,6 +16,8 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -76,4 +78,64 @@ int main()
assert(m.size() == 0);
assert(i == m.end());
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::set<int, std::less<int>, min_allocator<int>> M;
+ typedef int V;
+ typedef M::iterator I;
+ V ar[] =
+ {
+ 1,
+ 2,
+ 3,
+ 4,
+ 5,
+ 6,
+ 7,
+ 8
+ };
+ M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
+ assert(m.size() == 8);
+ I i = m.erase(next(m.cbegin(), 5), next(m.cbegin(), 5));
+ assert(m.size() == 8);
+ assert(i == next(m.begin(), 5));
+ assert(*next(m.begin(), 0) == 1);
+ assert(*next(m.begin(), 1) == 2);
+ assert(*next(m.begin(), 2) == 3);
+ assert(*next(m.begin(), 3) == 4);
+ assert(*next(m.begin(), 4) == 5);
+ assert(*next(m.begin(), 5) == 6);
+ assert(*next(m.begin(), 6) == 7);
+ assert(*next(m.begin(), 7) == 8);
+
+ i = m.erase(next(m.cbegin(), 3), next(m.cbegin(), 4));
+ assert(m.size() == 7);
+ assert(i == next(m.begin(), 3));
+ assert(*next(m.begin(), 0) == 1);
+ assert(*next(m.begin(), 1) == 2);
+ assert(*next(m.begin(), 2) == 3);
+ assert(*next(m.begin(), 3) == 5);
+ assert(*next(m.begin(), 4) == 6);
+ assert(*next(m.begin(), 5) == 7);
+ assert(*next(m.begin(), 6) == 8);
+
+ i = m.erase(next(m.cbegin(), 2), next(m.cbegin(), 5));
+ assert(m.size() == 4);
+ assert(i == next(m.begin(), 2));
+ assert(*next(m.begin(), 0) == 1);
+ assert(*next(m.begin(), 1) == 2);
+ assert(*next(m.begin(), 2) == 7);
+ assert(*next(m.begin(), 3) == 8);
+
+ i = m.erase(next(m.cbegin(), 0), next(m.cbegin(), 2));
+ assert(m.size() == 2);
+ assert(i == next(m.begin(), 0));
+ assert(*next(m.begin(), 0) == 7);
+ assert(*next(m.begin(), 1) == 8);
+
+ i = m.erase(m.cbegin(), m.cend());
+ assert(m.size() == 0);
+ assert(i == m.end());
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/set/erase_key.pass.cpp b/libcxx/test/containers/associative/set/erase_key.pass.cpp
index 61455b6c94c..12ee0af980e 100644
--- a/libcxx/test/containers/associative/set/erase_key.pass.cpp
+++ b/libcxx/test/containers/associative/set/erase_key.pass.cpp
@@ -16,6 +16,8 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -107,4 +109,95 @@ int main()
assert(m.size() == 0);
assert(i == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::set<int, std::less<int>, min_allocator<int>> M;
+ typedef int V;
+ typedef M::size_type I;
+ V ar[] =
+ {
+ 1,
+ 2,
+ 3,
+ 4,
+ 5,
+ 6,
+ 7,
+ 8
+ };
+ M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
+ assert(m.size() == 8);
+ I i = m.erase(9);
+ assert(m.size() == 8);
+ assert(i == 0);
+ assert(*next(m.begin(), 0) == 1);
+ assert(*next(m.begin(), 1) == 2);
+ assert(*next(m.begin(), 2) == 3);
+ assert(*next(m.begin(), 3) == 4);
+ assert(*next(m.begin(), 4) == 5);
+ assert(*next(m.begin(), 5) == 6);
+ assert(*next(m.begin(), 6) == 7);
+ assert(*next(m.begin(), 7) == 8);
+
+ i = m.erase(4);
+ assert(m.size() == 7);
+ assert(i == 1);
+ assert(*next(m.begin(), 0) == 1);
+ assert(*next(m.begin(), 1) == 2);
+ assert(*next(m.begin(), 2) == 3);
+ assert(*next(m.begin(), 3) == 5);
+ assert(*next(m.begin(), 4) == 6);
+ assert(*next(m.begin(), 5) == 7);
+ assert(*next(m.begin(), 6) == 8);
+
+ i = m.erase(1);
+ assert(m.size() == 6);
+ assert(i == 1);
+ assert(*next(m.begin(), 0) == 2);
+ assert(*next(m.begin(), 1) == 3);
+ assert(*next(m.begin(), 2) == 5);
+ assert(*next(m.begin(), 3) == 6);
+ assert(*next(m.begin(), 4) == 7);
+ assert(*next(m.begin(), 5) == 8);
+
+ i = m.erase(8);
+ assert(m.size() == 5);
+ assert(i == 1);
+ assert(*next(m.begin(), 0) == 2);
+ assert(*next(m.begin(), 1) == 3);
+ assert(*next(m.begin(), 2) == 5);
+ assert(*next(m.begin(), 3) == 6);
+ assert(*next(m.begin(), 4) == 7);
+
+ i = m.erase(3);
+ assert(m.size() == 4);
+ assert(i == 1);
+ assert(*next(m.begin(), 0) == 2);
+ assert(*next(m.begin(), 1) == 5);
+ assert(*next(m.begin(), 2) == 6);
+ assert(*next(m.begin(), 3) == 7);
+
+ i = m.erase(6);
+ assert(m.size() == 3);
+ assert(i == 1);
+ assert(*next(m.begin(), 0) == 2);
+ assert(*next(m.begin(), 1) == 5);
+ assert(*next(m.begin(), 2) == 7);
+
+ i = m.erase(7);
+ assert(m.size() == 2);
+ assert(i == 1);
+ assert(*next(m.begin(), 0) == 2);
+ assert(*next(m.begin(), 1) == 5);
+
+ i = m.erase(2);
+ assert(m.size() == 1);
+ assert(i == 1);
+ assert(*next(m.begin(), 0) == 5);
+
+ i = m.erase(5);
+ assert(m.size() == 0);
+ assert(i == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/set/find.pass.cpp b/libcxx/test/containers/associative/set/find.pass.cpp
index 96ab73b37b5..b661898a861 100644
--- a/libcxx/test/containers/associative/set/find.pass.cpp
+++ b/libcxx/test/containers/associative/set/find.pass.cpp
@@ -17,8 +17,11 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
+ {
typedef int V;
typedef std::set<int> M;
{
@@ -87,4 +90,77 @@ int main()
r = m.find(4);
assert(r == next(m.begin(), 8));
}
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef int V;
+ typedef std::set<int, std::less<int>, min_allocator<int>> M;
+ {
+ typedef M::iterator R;
+ V ar[] =
+ {
+ 5,
+ 6,
+ 7,
+ 8,
+ 9,
+ 10,
+ 11,
+ 12
+ };
+ M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.find(5);
+ assert(r == m.begin());
+ r = m.find(6);
+ assert(r == next(m.begin()));
+ r = m.find(7);
+ assert(r == next(m.begin(), 2));
+ r = m.find(8);
+ assert(r == next(m.begin(), 3));
+ r = m.find(9);
+ assert(r == next(m.begin(), 4));
+ r = m.find(10);
+ assert(r == next(m.begin(), 5));
+ r = m.find(11);
+ assert(r == next(m.begin(), 6));
+ r = m.find(12);
+ assert(r == next(m.begin(), 7));
+ r = m.find(4);
+ assert(r == next(m.begin(), 8));
+ }
+ {
+ typedef M::const_iterator R;
+ V ar[] =
+ {
+ 5,
+ 6,
+ 7,
+ 8,
+ 9,
+ 10,
+ 11,
+ 12
+ };
+ const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.find(5);
+ assert(r == m.begin());
+ r = m.find(6);
+ assert(r == next(m.begin()));
+ r = m.find(7);
+ assert(r == next(m.begin(), 2));
+ r = m.find(8);
+ assert(r == next(m.begin(), 3));
+ r = m.find(9);
+ assert(r == next(m.begin(), 4));
+ r = m.find(10);
+ assert(r == next(m.begin(), 5));
+ r = m.find(11);
+ assert(r == next(m.begin(), 6));
+ r = m.find(12);
+ assert(r == next(m.begin(), 7));
+ r = m.find(4);
+ assert(r == next(m.begin(), 8));
+ }
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/set/insert_cv.pass.cpp b/libcxx/test/containers/associative/set/insert_cv.pass.cpp
index 9cbb61618c1..eabd1a8722a 100644
--- a/libcxx/test/containers/associative/set/insert_cv.pass.cpp
+++ b/libcxx/test/containers/associative/set/insert_cv.pass.cpp
@@ -16,6 +16,8 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -46,4 +48,34 @@ int main()
assert(m.size() == 3);
assert(*r.first == 3);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::set<int, std::less<int>, min_allocator<int>> M;
+ typedef std::pair<M::iterator, bool> R;
+ M m;
+ R r = m.insert(M::value_type(2));
+ assert(r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 1);
+ assert(*r.first == 2);
+
+ r = m.insert(M::value_type(1));
+ assert(r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 2);
+ assert(*r.first == 1);
+
+ r = m.insert(M::value_type(3));
+ assert(r.second);
+ assert(r.first == prev(m.end()));
+ assert(m.size() == 3);
+ assert(*r.first == 3);
+
+ r = m.insert(M::value_type(3));
+ assert(!r.second);
+ assert(r.first == prev(m.end()));
+ assert(m.size() == 3);
+ assert(*r.first == 3);
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/set/insert_initializer_list.pass.cpp b/libcxx/test/containers/associative/set/insert_initializer_list.pass.cpp
index e9245cd46b2..d75e8a8bcbd 100644
--- a/libcxx/test/containers/associative/set/insert_initializer_list.pass.cpp
+++ b/libcxx/test/containers/associative/set/insert_initializer_list.pass.cpp
@@ -16,9 +16,12 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ {
typedef std::set<int> C;
typedef C::value_type V;
C m = {10, 8};
@@ -34,5 +37,25 @@ int main()
assert(*++i == V(6));
assert(*++i == V(8));
assert(*++i == V(10));
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::set<int, std::less<int>, min_allocator<int>> C;
+ typedef C::value_type V;
+ C m = {10, 8};
+ m.insert({1, 2, 3, 4, 5, 6});
+ assert(m.size() == 8);
+ assert(distance(m.begin(), m.end()) == m.size());
+ C::const_iterator i = m.cbegin();
+ assert(*i == V(1));
+ assert(*++i == V(2));
+ assert(*++i == V(3));
+ assert(*++i == V(4));
+ assert(*++i == V(5));
+ assert(*++i == V(6));
+ assert(*++i == V(8));
+ assert(*++i == V(10));
+ }
+#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
diff --git a/libcxx/test/containers/associative/set/insert_iter_cv.pass.cpp b/libcxx/test/containers/associative/set/insert_iter_cv.pass.cpp
index 78ce18337c9..d86d40e8909 100644
--- a/libcxx/test/containers/associative/set/insert_iter_cv.pass.cpp
+++ b/libcxx/test/containers/associative/set/insert_iter_cv.pass.cpp
@@ -16,6 +16,8 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -42,4 +44,30 @@ int main()
assert(m.size() == 3);
assert(*r == 3);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::set<int, std::less<int>, min_allocator<int>> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.insert(m.cend(), M::value_type(2));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(*r == 2);
+
+ r = m.insert(m.cend(), M::value_type(1));
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(*r == 1);
+
+ r = m.insert(m.cend(), M::value_type(3));
+ assert(r == prev(m.end()));
+ assert(m.size() == 3);
+ assert(*r == 3);
+
+ r = m.insert(m.cend(), M::value_type(3));
+ assert(r == prev(m.end()));
+ assert(m.size() == 3);
+ assert(*r == 3);
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/set/insert_iter_iter.pass.cpp b/libcxx/test/containers/associative/set/insert_iter_iter.pass.cpp
index 3bc3a61544d..d99dbe365ac 100644
--- a/libcxx/test/containers/associative/set/insert_iter_iter.pass.cpp
+++ b/libcxx/test/containers/associative/set/insert_iter_iter.pass.cpp
@@ -18,6 +18,7 @@
#include <cassert>
#include "test_iterators.h"
+#include "../../min_allocator.h"
int main()
{
@@ -44,4 +45,29 @@ int main()
assert(*next(m.begin()) == 2);
assert(*next(m.begin(), 2) == 3);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::set<int, std::less<int>, min_allocator<int>> M;
+ typedef int V;
+ V ar[] =
+ {
+ 1,
+ 1,
+ 1,
+ 2,
+ 2,
+ 2,
+ 3,
+ 3,
+ 3
+ };
+ M m;
+ m.insert(input_iterator<const V*>(ar),
+ input_iterator<const V*>(ar + sizeof(ar)/sizeof(ar[0])));
+ assert(m.size() == 3);
+ assert(*m.begin() == 1);
+ assert(*next(m.begin()) == 2);
+ assert(*next(m.begin(), 2) == 3);
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/set/insert_iter_rv.pass.cpp b/libcxx/test/containers/associative/set/insert_iter_rv.pass.cpp
index fdf9f05972c..cf2dcbf91bb 100644
--- a/libcxx/test/containers/associative/set/insert_iter_rv.pass.cpp
+++ b/libcxx/test/containers/associative/set/insert_iter_rv.pass.cpp
@@ -17,6 +17,7 @@
#include <cassert>
#include "../../MoveOnly.h"
+#include "../../min_allocator.h"
int main()
{
@@ -45,5 +46,31 @@ int main()
assert(m.size() == 3);
assert(*r == 3);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::set<MoveOnly, std::less<MoveOnly>, min_allocator<MoveOnly>> M;
+ typedef M::iterator R;
+ M m;
+ R r = m.insert(m.cend(), M::value_type(2));
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(*r == 2);
+
+ r = m.insert(m.cend(), M::value_type(1));
+ assert(r == m.begin());
+ assert(m.size() == 2);
+ assert(*r == 1);
+
+ r = m.insert(m.cend(), M::value_type(3));
+ assert(r == prev(m.end()));
+ assert(m.size() == 3);
+ assert(*r == 3);
+
+ r = m.insert(m.cend(), M::value_type(3));
+ assert(r == prev(m.end()));
+ assert(m.size() == 3);
+ assert(*r == 3);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/libcxx/test/containers/associative/set/insert_rv.pass.cpp b/libcxx/test/containers/associative/set/insert_rv.pass.cpp
index c7e868d7911..0b58af6cad0 100644
--- a/libcxx/test/containers/associative/set/insert_rv.pass.cpp
+++ b/libcxx/test/containers/associative/set/insert_rv.pass.cpp
@@ -17,6 +17,7 @@
#include <cassert>
#include "../../MoveOnly.h"
+#include "../../min_allocator.h"
int main()
{
@@ -49,5 +50,35 @@ int main()
assert(m.size() == 3);
assert(*r.first == 3);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::set<MoveOnly, std::less<MoveOnly>, min_allocator<MoveOnly>> M;
+ typedef std::pair<M::iterator, bool> R;
+ M m;
+ R r = m.insert(M::value_type(2));
+ assert(r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 1);
+ assert(*r.first == 2);
+
+ r = m.insert(M::value_type(1));
+ assert(r.second);
+ assert(r.first == m.begin());
+ assert(m.size() == 2);
+ assert(*r.first == 1);
+
+ r = m.insert(M::value_type(3));
+ assert(r.second);
+ assert(r.first == prev(m.end()));
+ assert(m.size() == 3);
+ assert(*r.first == 3);
+
+ r = m.insert(M::value_type(3));
+ assert(!r.second);
+ assert(r.first == prev(m.end()));
+ assert(m.size() == 3);
+ assert(*r.first == 3);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/libcxx/test/containers/associative/set/iterator.pass.cpp b/libcxx/test/containers/associative/set/iterator.pass.cpp
index eb401951aaa..b509aea0cb7 100644
--- a/libcxx/test/containers/associative/set/iterator.pass.cpp
+++ b/libcxx/test/containers/associative/set/iterator.pass.cpp
@@ -29,6 +29,8 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -104,9 +106,89 @@ int main()
assert(std::distance(m.cbegin(), m.cend()) == m.size());
assert(std::distance(m.rbegin(), m.rend()) == m.size());
assert(std::distance(m.crbegin(), m.crend()) == m.size());
- std::set<int, double>::const_iterator i;
+ std::set<int>::const_iterator i;
+ i = m.begin();
+ for (int j = 1; j <= m.size(); ++j, ++i)
+ assert(*i == j);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef int V;
+ V ar[] =
+ {
+ 1,
+ 1,
+ 1,
+ 2,
+ 2,
+ 2,
+ 3,
+ 3,
+ 3,
+ 4,
+ 4,
+ 4,
+ 5,
+ 5,
+ 5,
+ 6,
+ 6,
+ 6,
+ 7,
+ 7,
+ 7,
+ 8,
+ 8,
+ 8
+ };
+ std::set<int, std::less<int>, min_allocator<int>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ assert(std::distance(m.begin(), m.end()) == m.size());
+ assert(std::distance(m.rbegin(), m.rend()) == m.size());
+ std::set<int, std::less<int>, min_allocator<int>>::iterator i;
+ i = m.begin();
+ std::set<int, std::less<int>, min_allocator<int>>::const_iterator k = i;
+ assert(i == k);
+ for (int j = 1; j <= m.size(); ++j, ++i)
+ assert(*i == j);
+ }
+ {
+ typedef int V;
+ V ar[] =
+ {
+ 1,
+ 1,
+ 1,
+ 2,
+ 2,
+ 2,
+ 3,
+ 3,
+ 3,
+ 4,
+ 4,
+ 4,
+ 5,
+ 5,
+ 5,
+ 6,
+ 6,
+ 6,
+ 7,
+ 7,
+ 7,
+ 8,
+ 8,
+ 8
+ };
+ const std::set<int, std::less<int>, min_allocator<int>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ assert(std::distance(m.begin(), m.end()) == m.size());
+ assert(std::distance(m.cbegin(), m.cend()) == m.size());
+ assert(std::distance(m.rbegin(), m.rend()) == m.size());
+ assert(std::distance(m.crbegin(), m.crend()) == m.size());
+ std::set<int, std::less<int>, min_allocator<int>>::const_iterator i;
i = m.begin();
for (int j = 1; j <= m.size(); ++j, ++i)
assert(*i == j);
}
+#endif
}
diff --git a/libcxx/test/containers/associative/set/lower_bound.pass.cpp b/libcxx/test/containers/associative/set/lower_bound.pass.cpp
index 8703c8a16b7..072a5879157 100644
--- a/libcxx/test/containers/associative/set/lower_bound.pass.cpp
+++ b/libcxx/test/containers/associative/set/lower_bound.pass.cpp
@@ -17,8 +17,11 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
+ {
typedef int V;
typedef std::set<int> M;
{
@@ -119,4 +122,109 @@ int main()
r = m.lower_bound(20);
assert(r == next(m.begin(), 8));
}
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef int V;
+ typedef std::set<int, std::less<int>, min_allocator<int>> M;
+ {
+ typedef M::iterator R;
+ V ar[] =
+ {
+ 5,
+ 7,
+ 9,
+ 11,
+ 13,
+ 15,
+ 17,
+ 19
+ };
+ M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.lower_bound(5);
+ assert(r == m.begin());
+ r = m.lower_bound(7);
+ assert(r == next(m.begin()));
+ r = m.lower_bound(9);
+ assert(r == next(m.begin(), 2));
+ r = m.lower_bound(11);
+ assert(r == next(m.begin(), 3));
+ r = m.lower_bound(13);
+ assert(r == next(m.begin(), 4));
+ r = m.lower_bound(15);
+ assert(r == next(m.begin(), 5));
+ r = m.lower_bound(17);
+ assert(r == next(m.begin(), 6));
+ r = m.lower_bound(19);
+ assert(r == next(m.begin(), 7));
+ r = m.lower_bound(4);
+ assert(r == next(m.begin(), 0));
+ r = m.lower_bound(6);
+ assert(r == next(m.begin(), 1));
+ r = m.lower_bound(8);
+ assert(r == next(m.begin(), 2));
+ r = m.lower_bound(10);
+ assert(r == next(m.begin(), 3));
+ r = m.lower_bound(12);
+ assert(r == next(m.begin(), 4));
+ r = m.lower_bound(14);
+ assert(r == next(m.begin(), 5));
+ r = m.lower_bound(16);
+ assert(r == next(m.begin(), 6));
+ r = m.lower_bound(18);
+ assert(r == next(m.begin(), 7));
+ r = m.lower_bound(20);
+ assert(r == next(m.begin(), 8));
+ }
+ {
+ typedef M::const_iterator R;
+ V ar[] =
+ {
+ 5,
+ 7,
+ 9,
+ 11,
+ 13,
+ 15,
+ 17,
+ 19
+ };
+ const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.lower_bound(5);
+ assert(r == m.begin());
+ r = m.lower_bound(7);
+ assert(r == next(m.begin()));
+ r = m.lower_bound(9);
+ assert(r == next(m.begin(), 2));
+ r = m.lower_bound(11);
+ assert(r == next(m.begin(), 3));
+ r = m.lower_bound(13);
+ assert(r == next(m.begin(), 4));
+ r = m.lower_bound(15);
+ assert(r == next(m.begin(), 5));
+ r = m.lower_bound(17);
+ assert(r == next(m.begin(), 6));
+ r = m.lower_bound(19);
+ assert(r == next(m.begin(), 7));
+ r = m.lower_bound(4);
+ assert(r == next(m.begin(), 0));
+ r = m.lower_bound(6);
+ assert(r == next(m.begin(), 1));
+ r = m.lower_bound(8);
+ assert(r == next(m.begin(), 2));
+ r = m.lower_bound(10);
+ assert(r == next(m.begin(), 3));
+ r = m.lower_bound(12);
+ assert(r == next(m.begin(), 4));
+ r = m.lower_bound(14);
+ assert(r == next(m.begin(), 5));
+ r = m.lower_bound(16);
+ assert(r == next(m.begin(), 6));
+ r = m.lower_bound(18);
+ assert(r == next(m.begin(), 7));
+ r = m.lower_bound(20);
+ assert(r == next(m.begin(), 8));
+ }
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/set/max_size.pass.cpp b/libcxx/test/containers/associative/set/max_size.pass.cpp
index 493c78514a8..b744b9eb16a 100644
--- a/libcxx/test/containers/associative/set/max_size.pass.cpp
+++ b/libcxx/test/containers/associative/set/max_size.pass.cpp
@@ -16,9 +16,20 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
+ {
typedef std::set<int> M;
M m;
assert(m.max_size() != 0);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::set<int, std::less<int>, min_allocator<int>> M;
+ M m;
+ assert(m.max_size() != 0);
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/set/set.cons/assign_initializer_list.pass.cpp b/libcxx/test/containers/associative/set/set.cons/assign_initializer_list.pass.cpp
index b37e0d4740e..26f38e94b19 100644
--- a/libcxx/test/containers/associative/set/set.cons/assign_initializer_list.pass.cpp
+++ b/libcxx/test/containers/associative/set/set.cons/assign_initializer_list.pass.cpp
@@ -16,9 +16,12 @@
#include <set>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ {
typedef std::set<int> C;
typedef C::value_type V;
C m = {10, 8};
@@ -32,5 +35,23 @@ int main()
assert(*++i == V(4));
assert(*++i == V(5));
assert(*++i == V(6));
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::set<int, std::less<int>, min_allocator<int>> C;
+ typedef C::value_type V;
+ C m = {10, 8};
+ m = {1, 2, 3, 4, 5, 6};
+ assert(m.size() == 6);
+ assert(distance(m.begin(), m.end()) == 6);
+ C::const_iterator i = m.cbegin();
+ assert(*i == V(1));
+ assert(*++i == V(2));
+ assert(*++i == V(3));
+ assert(*++i == V(4));
+ assert(*++i == V(5));
+ assert(*++i == V(6));
+ }
+#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
diff --git a/libcxx/test/containers/associative/set/set.cons/default.pass.cpp b/libcxx/test/containers/associative/set/set.cons/default.pass.cpp
index 955a0d37df4..300b4fc6873 100644
--- a/libcxx/test/containers/associative/set/set.cons/default.pass.cpp
+++ b/libcxx/test/containers/associative/set/set.cons/default.pass.cpp
@@ -16,9 +16,20 @@
#include <set>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
+ {
std::set<int> m;
assert(m.empty());
assert(m.begin() == m.end());
+ }
+#if __cplusplus >= 201103L
+ {
+ std::set<int, std::less<int>, min_allocator<int>> m;
+ assert(m.empty());
+ assert(m.begin() == m.end());
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/set/set.cons/initializer_list.pass.cpp b/libcxx/test/containers/associative/set/set.cons/initializer_list.pass.cpp
index badb107ab86..7d981a11a85 100644
--- a/libcxx/test/containers/associative/set/set.cons/initializer_list.pass.cpp
+++ b/libcxx/test/containers/associative/set/set.cons/initializer_list.pass.cpp
@@ -16,9 +16,12 @@
#include <set>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ {
typedef std::set<int> C;
typedef C::value_type V;
C m = {1, 2, 3, 4, 5, 6};
@@ -31,5 +34,22 @@ int main()
assert(*++i == V(4));
assert(*++i == V(5));
assert(*++i == V(6));
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::set<int, std::less<int>, min_allocator<int>> C;
+ typedef C::value_type V;
+ C m = {1, 2, 3, 4, 5, 6};
+ assert(m.size() == 6);
+ assert(distance(m.begin(), m.end()) == 6);
+ C::const_iterator i = m.cbegin();
+ assert(*i == V(1));
+ assert(*++i == V(2));
+ assert(*++i == V(3));
+ assert(*++i == V(4));
+ assert(*++i == V(5));
+ assert(*++i == V(6));
+ }
+#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
diff --git a/libcxx/test/containers/associative/set/set.cons/iter_iter.pass.cpp b/libcxx/test/containers/associative/set/set.cons/iter_iter.pass.cpp
index ff068503e5b..3248257fe2a 100644
--- a/libcxx/test/containers/associative/set/set.cons/iter_iter.pass.cpp
+++ b/libcxx/test/containers/associative/set/set.cons/iter_iter.pass.cpp
@@ -18,9 +18,11 @@
#include <cassert>
#include "test_iterators.h"
+#include "../../../min_allocator.h"
int main()
{
+ {
typedef int V;
V ar[] =
{
@@ -41,4 +43,29 @@ int main()
assert(*m.begin() == 1);
assert(*next(m.begin()) == 2);
assert(*next(m.begin(), 2) == 3);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef int V;
+ V ar[] =
+ {
+ 1,
+ 1,
+ 1,
+ 2,
+ 2,
+ 2,
+ 3,
+ 3,
+ 3
+ };
+ std::set<V, std::less<int>, min_allocator<int>> m(input_iterator<const int*>(ar),
+ input_iterator<const int*>(ar+sizeof(ar)/sizeof(ar[0])));
+ assert(m.size() == 3);
+ assert(distance(m.begin(), m.end()) == 3);
+ assert(*m.begin() == 1);
+ assert(*next(m.begin()) == 2);
+ assert(*next(m.begin(), 2) == 3);
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/set/set.cons/move.pass.cpp b/libcxx/test/containers/associative/set/set.cons/move.pass.cpp
index 350513ab995..2d1b37f4e07 100644
--- a/libcxx/test/containers/associative/set/set.cons/move.pass.cpp
+++ b/libcxx/test/containers/associative/set/set.cons/move.pass.cpp
@@ -18,6 +18,7 @@
#include "../../../test_compare.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -69,5 +70,38 @@ int main()
assert(mo.size() == 0);
assert(distance(mo.begin(), mo.end()) == 0);
}
+#if __cplusplus >= 201103L
+ {
+ typedef int V;
+ V ar[] =
+ {
+ 1,
+ 1,
+ 1,
+ 2,
+ 2,
+ 2,
+ 3,
+ 3,
+ 3
+ };
+ typedef test_compare<std::less<int> > C;
+ typedef min_allocator<V> A;
+ std::set<int, C, A> mo(ar, ar+sizeof(ar)/sizeof(ar[0]), C(5), A());
+ std::set<int, C, A> m = std::move(mo);
+ assert(m.get_allocator() == A());
+ assert(m.key_comp() == C(5));
+ assert(m.size() == 3);
+ assert(distance(m.begin(), m.end()) == 3);
+ assert(*m.begin() == 1);
+ assert(*next(m.begin()) == 2);
+ assert(*next(m.begin(), 2) == 3);
+
+ assert(mo.get_allocator() == A());
+ assert(mo.key_comp() == C(5));
+ assert(mo.size() == 0);
+ assert(distance(mo.begin(), mo.end()) == 0);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/libcxx/test/containers/associative/set/set.cons/move_assign.pass.cpp b/libcxx/test/containers/associative/set/set.cons/move_assign.pass.cpp
index 15bcb6d64e2..3e82e28d516 100644
--- a/libcxx/test/containers/associative/set/set.cons/move_assign.pass.cpp
+++ b/libcxx/test/containers/associative/set/set.cons/move_assign.pass.cpp
@@ -19,6 +19,7 @@
#include "../../../MoveOnly.h"
#include "../../../test_compare.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -140,5 +141,46 @@ int main()
assert(m3.key_comp() == C(5));
assert(m1.empty());
}
+#if __cplusplus >= 201103L
+ {
+ typedef MoveOnly V;
+ typedef test_compare<std::less<MoveOnly> > C;
+ typedef min_allocator<V> A;
+ typedef std::set<MoveOnly, C, A> M;
+ typedef std::move_iterator<V*> I;
+ V a1[] =
+ {
+ V(1),
+ V(1),
+ V(1),
+ V(2),
+ V(2),
+ V(2),
+ V(3),
+ V(3),
+ V(3)
+ };
+ M m1(I(a1), I(a1+sizeof(a1)/sizeof(a1[0])), C(5), A());
+ V a2[] =
+ {
+ V(1),
+ V(1),
+ V(1),
+ V(2),
+ V(2),
+ V(2),
+ V(3),
+ V(3),
+ V(3)
+ };
+ M m2(I(a2), I(a2+sizeof(a2)/sizeof(a2[0])), C(5), A());
+ M m3(C(3), A());
+ m3 = std::move(m1);
+ assert(m3 == m2);
+ assert(m3.get_allocator() == A());
+ assert(m3.key_comp() == C(5));
+ assert(m1.empty());
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/libcxx/test/containers/associative/set/set.special/member_swap.pass.cpp b/libcxx/test/containers/associative/set/set.special/member_swap.pass.cpp
index 0ac283729ed..aa38fe03577 100644
--- a/libcxx/test/containers/associative/set/set.special/member_swap.pass.cpp
+++ b/libcxx/test/containers/associative/set/set.special/member_swap.pass.cpp
@@ -16,8 +16,11 @@
#include <set>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
+ {
typedef int V;
typedef std::set<int> M;
{
@@ -104,4 +107,95 @@ int main()
assert(m1 == m2_save);
assert(m2 == m1_save);
}
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef int V;
+ typedef std::set<int, std::less<int>, min_allocator<int>> M;
+ {
+ V ar1[] =
+ {
+ };
+ V ar2[] =
+ {
+ };
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ }
+ {
+ V ar1[] =
+ {
+ };
+ V ar2[] =
+ {
+ 5,
+ 6,
+ 7,
+ 8,
+ 9,
+ 10,
+ 11,
+ 12
+ };
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ }
+ {
+ V ar1[] =
+ {
+ 1,
+ 2,
+ 3,
+ 4
+ };
+ V ar2[] =
+ {
+ };
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ }
+ {
+ V ar1[] =
+ {
+ 1,
+ 2,
+ 3,
+ 4
+ };
+ V ar2[] =
+ {
+ 5,
+ 6,
+ 7,
+ 8,
+ 9,
+ 10,
+ 11,
+ 12
+ };
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]));
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]));
+ M m1_save = m1;
+ M m2_save = m2;
+ m1.swap(m2);
+ assert(m1 == m2_save);
+ assert(m2 == m1_save);
+ }
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/set/size.pass.cpp b/libcxx/test/containers/associative/set/size.pass.cpp
index e2083031191..e1b6b6ce7c8 100644
--- a/libcxx/test/containers/associative/set/size.pass.cpp
+++ b/libcxx/test/containers/associative/set/size.pass.cpp
@@ -16,8 +16,11 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
+ {
typedef std::set<int> M;
M m;
assert(m.size() == 0);
@@ -33,4 +36,24 @@ int main()
assert(m.size() == 1);
m.erase(m.begin());
assert(m.size() == 0);
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef std::set<int, std::less<int>, min_allocator<int>> M;
+ M m;
+ assert(m.size() == 0);
+ m.insert(M::value_type(2));
+ assert(m.size() == 1);
+ m.insert(M::value_type(1));
+ assert(m.size() == 2);
+ m.insert(M::value_type(3));
+ assert(m.size() == 3);
+ m.erase(m.begin());
+ assert(m.size() == 2);
+ m.erase(m.begin());
+ assert(m.size() == 1);
+ m.erase(m.begin());
+ assert(m.size() == 0);
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/set/types.pass.cpp b/libcxx/test/containers/associative/set/types.pass.cpp
index 5a6b2c3d4cd..04b9ead0381 100644
--- a/libcxx/test/containers/associative/set/types.pass.cpp
+++ b/libcxx/test/containers/associative/set/types.pass.cpp
@@ -32,8 +32,11 @@
#include <set>
#include <type_traits>
+#include "../../min_allocator.h"
+
int main()
{
+ {
static_assert((std::is_same<std::set<int>::key_type, int>::value), "");
static_assert((std::is_same<std::set<int>::value_type, int>::value), "");
static_assert((std::is_same<std::set<int>::key_compare, std::less<int> >::value), "");
@@ -45,4 +48,20 @@ int main()
static_assert((std::is_same<std::set<int>::const_pointer, const int*>::value), "");
static_assert((std::is_same<std::set<int>::size_type, std::size_t>::value), "");
static_assert((std::is_same<std::set<int>::difference_type, std::ptrdiff_t>::value), "");
+ }
+#if __cplusplus >= 201103L
+ {
+ static_assert((std::is_same<std::set<int, std::less<int>, min_allocator<int>>::key_type, int>::value), "");
+ static_assert((std::is_same<std::set<int, std::less<int>, min_allocator<int>>::value_type, int>::value), "");
+ static_assert((std::is_same<std::set<int, std::less<int>, min_allocator<int>>::key_compare, std::less<int> >::value), "");
+ static_assert((std::is_same<std::set<int, std::less<int>, min_allocator<int>>::value_compare, std::less<int> >::value), "");
+ static_assert((std::is_same<std::set<int, std::less<int>, min_allocator<int>>::allocator_type, min_allocator<int> >::value), "");
+ static_assert((std::is_same<std::set<int, std::less<int>, min_allocator<int>>::reference, int&>::value), "");
+ static_assert((std::is_same<std::set<int, std::less<int>, min_allocator<int>>::const_reference, const int&>::value), "");
+ static_assert((std::is_same<std::set<int, std::less<int>, min_allocator<int>>::pointer, min_pointer<int>>::value), "");
+ static_assert((std::is_same<std::set<int, std::less<int>, min_allocator<int>>::const_pointer, min_pointer<const int>>::value), "");
+ static_assert((std::is_same<std::set<int, std::less<int>, min_allocator<int>>::size_type, std::size_t>::value), "");
+ static_assert((std::is_same<std::set<int, std::less<int>, min_allocator<int>>::difference_type, std::ptrdiff_t>::value), "");
+ }
+#endif
}
diff --git a/libcxx/test/containers/associative/set/upper_bound.pass.cpp b/libcxx/test/containers/associative/set/upper_bound.pass.cpp
index 8f5713308c0..3d000d88e57 100644
--- a/libcxx/test/containers/associative/set/upper_bound.pass.cpp
+++ b/libcxx/test/containers/associative/set/upper_bound.pass.cpp
@@ -17,8 +17,11 @@
#include <set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
+ {
typedef int V;
typedef std::set<int> M;
{
@@ -119,4 +122,109 @@ int main()
r = m.upper_bound(20);
assert(r == next(m.begin(), 8));
}
+ }
+#if __cplusplus >= 201103L
+ {
+ typedef int V;
+ typedef std::set<int, std::less<int>, min_allocator<int>> M;
+ {
+ typedef M::iterator R;
+ V ar[] =
+ {
+ 5,
+ 7,
+ 9,
+ 11,
+ 13,
+ 15,
+ 17,
+ 19
+ };
+ M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.upper_bound(5);
+ assert(r == next(m.begin(), 1));
+ r = m.upper_bound(7);
+ assert(r == next(m.begin(), 2));
+ r = m.upper_bound(9);
+ assert(r == next(m.begin(), 3));
+ r = m.upper_bound(11);
+ assert(r == next(m.begin(), 4));
+ r = m.upper_bound(13);
+ assert(r == next(m.begin(), 5));
+ r = m.upper_bound(15);
+ assert(r == next(m.begin(), 6));
+ r = m.upper_bound(17);
+ assert(r == next(m.begin(), 7));
+ r = m.upper_bound(19);
+ assert(r == next(m.begin(), 8));
+ r = m.upper_bound(4);
+ assert(r == next(m.begin(), 0));
+ r = m.upper_bound(6);
+ assert(r == next(m.begin(), 1));
+ r = m.upper_bound(8);
+ assert(r == next(m.begin(), 2));
+ r = m.upper_bound(10);
+ assert(r == next(m.begin(), 3));
+ r = m.upper_bound(12);
+ assert(r == next(m.begin(), 4));
+ r = m.upper_bound(14);
+ assert(r == next(m.begin(), 5));
+ r = m.upper_bound(16);
+ assert(r == next(m.begin(), 6));
+ r = m.upper_bound(18);
+ assert(r == next(m.begin(), 7));
+ r = m.upper_bound(20);
+ assert(r == next(m.begin(), 8));
+ }
+ {
+ typedef M::const_iterator R;
+ V ar[] =
+ {
+ 5,
+ 7,
+ 9,
+ 11,
+ 13,
+ 15,
+ 17,
+ 19
+ };
+ const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+ R r = m.upper_bound(5);
+ assert(r == next(m.begin(), 1));
+ r = m.upper_bound(7);
+ assert(r == next(m.begin(), 2));
+ r = m.upper_bound(9);
+ assert(r == next(m.begin(), 3));
+ r = m.upper_bound(11);
+ assert(r == next(m.begin(), 4));
+ r = m.upper_bound(13);
+ assert(r == next(m.begin(), 5));
+ r = m.upper_bound(15);
+ assert(r == next(m.begin(), 6));
+ r = m.upper_bound(17);
+ assert(r == next(m.begin(), 7));
+ r = m.upper_bound(19);
+ assert(r == next(m.begin(), 8));
+ r = m.upper_bound(4);
+ assert(r == next(m.begin(), 0));
+ r = m.upper_bound(6);
+ assert(r == next(m.begin(), 1));
+ r = m.upper_bound(8);
+ assert(r == next(m.begin(), 2));
+ r = m.upper_bound(10);
+ assert(r == next(m.begin(), 3));
+ r = m.upper_bound(12);
+ assert(r == next(m.begin(), 4));
+ r = m.upper_bound(14);
+ assert(r == next(m.begin(), 5));
+ r = m.upper_bound(16);
+ assert(r == next(m.begin(), 6));
+ r = m.upper_bound(18);
+ assert(r == next(m.begin(), 7));
+ r = m.upper_bound(20);
+ assert(r == next(m.begin(), 8));
+ }
+ }
+#endif
}
diff --git a/libcxx/test/containers/min_allocator.h b/libcxx/test/containers/min_allocator.h
new file mode 100644
index 00000000000..7aa197758a5
--- /dev/null
+++ b/libcxx/test/containers/min_allocator.h
@@ -0,0 +1,268 @@
+#ifndef MIN_ALLOCATOR_H
+#define MIN_ALLOCATOR_H
+
+#if __cplusplus >= 201103L
+
+#include <memory>
+
+template <class T> class min_pointer;
+template <class T> class min_pointer<const T>;
+template <> class min_pointer<void>;
+template <> class min_pointer<const void>;
+template <class T> class min_allocator;
+
+template <class T>
+bool
+operator==(min_pointer<T> x, min_pointer<T> y);
+
+template <>
+class min_pointer<const void>
+{
+ const void* ptr_;
+public:
+ min_pointer() noexcept = default;
+ min_pointer(std::nullptr_t) : ptr_(nullptr) {}
+ template <class T>
+ min_pointer(min_pointer<T> p) : ptr_(p.ptr_) {}
+
+ explicit operator bool() const {return ptr_ != nullptr;}
+
+ template <class U> friend bool operator==(min_pointer<U>, min_pointer<U>);
+ template <class U> friend class min_pointer;
+};
+
+template <>
+class min_pointer<void>
+{
+ void* ptr_;
+public:
+ min_pointer() noexcept = default;
+ min_pointer(std::nullptr_t) : ptr_(nullptr) {}
+ template <class T,
+ class = typename std::enable_if
+ <
+ !std::is_const<T>::value
+ >::type
+ >
+ min_pointer(min_pointer<T> p) : ptr_(p.ptr_) {}
+
+ explicit operator bool() const {return ptr_ != nullptr;}
+
+ template <class U> friend bool operator==(min_pointer<U>, min_pointer<U>);
+ template <class U> friend class min_pointer;
+};
+
+template <class T>
+class min_pointer
+{
+ T* ptr_;
+
+ explicit min_pointer(T* p) : ptr_(p) {}
+public:
+ min_pointer() noexcept = default;
+ min_pointer(std::nullptr_t) : ptr_(nullptr) {}
+ explicit min_pointer(min_pointer<void> p) : ptr_(static_cast<T*>(p.ptr_)) {}
+
+ explicit operator bool() const {return ptr_ != nullptr;}
+
+ typedef std::ptrdiff_t difference_type;
+ typedef T& reference;
+ typedef T* pointer;
+ typedef T value_type;
+ typedef std::random_access_iterator_tag iterator_category;
+
+ reference operator*() const {return *ptr_;}
+ pointer operator->() const {return ptr_;}
+
+ min_pointer& operator++() {++ptr_; return *this;}
+ min_pointer operator++(int) {min_pointer tmp(*this); ++ptr_; return tmp;}
+
+ min_pointer& operator--() {--ptr_; return *this;}
+ min_pointer operator--(int) {min_pointer tmp(*this); --ptr_; return tmp;}
+
+ min_pointer& operator+=(difference_type n) {ptr_ += n; return *this;}
+ min_pointer& operator-=(difference_type n) {ptr_ -= n; return *this;}
+
+ min_pointer operator+(difference_type n) const
+ {
+ min_pointer tmp(*this);
+ tmp += n;
+ return tmp;
+ }
+
+ friend min_pointer operator+(difference_type n, min_pointer x)
+ {
+ return x + n;
+ }
+
+ min_pointer operator-(difference_type n) const
+ {
+ min_pointer tmp(*this);
+ tmp -= n;
+ return tmp;
+ }
+
+ friend difference_type operator-(min_pointer x, min_pointer y)
+ {
+ return x.ptr_ - y.ptr_;
+ }
+
+ reference operator[](difference_type n) const {return ptr_[n];}
+
+ friend bool operator< (min_pointer x, min_pointer y) {return x.ptr_ < y.ptr_;}
+ friend bool operator> (min_pointer x, min_pointer y) {return y < x;}
+ friend bool operator<=(min_pointer x, min_pointer y) {return !(y < x);}
+ friend bool operator>=(min_pointer x, min_pointer y) {return !(x < y);}
+
+ static min_pointer pointer_to(T& t) {return min_pointer(std::addressof(t));}
+
+ template <class U> friend bool operator==(min_pointer<U>, min_pointer<U>);
+ template <class U> friend class min_pointer;
+ template <class U> friend class min_allocator;
+};
+
+template <class T>
+class min_pointer<const T>
+{
+ const T* ptr_;
+
+ explicit min_pointer(const T* p) : ptr_(p) {}
+public:
+ min_pointer() noexcept = default;
+ min_pointer(std::nullptr_t) : ptr_(nullptr) {}
+ min_pointer(min_pointer<T> p) : ptr_(p.ptr_) {}
+ explicit min_pointer(min_pointer<const void> p) : ptr_(static_cast<const T*>(p.ptr_)) {}
+
+ explicit operator bool() const {return ptr_ != nullptr;}
+
+ typedef std::ptrdiff_t difference_type;
+ typedef const T& reference;
+ typedef const T* pointer;
+ typedef const T value_type;
+ typedef std::random_access_iterator_tag iterator_category;
+
+ reference operator*() const {return *ptr_;}
+ pointer operator->() const {return ptr_;}
+
+ min_pointer& operator++() {++ptr_; return *this;}
+ min_pointer operator++(int) {min_pointer tmp(*this); ++ptr_; return tmp;}
+
+ min_pointer& operator--() {--ptr_; return *this;}
+ min_pointer operator--(int) {min_pointer tmp(*this); --ptr_; return tmp;}
+
+ min_pointer& operator+=(difference_type n) {ptr_ += n; return *this;}
+ min_pointer& operator-=(difference_type n) {ptr_ -= n; return *this;}
+
+ min_pointer operator+(difference_type n) const
+ {
+ min_pointer tmp(*this);
+ tmp += n;
+ return tmp;
+ }
+
+ friend min_pointer operator+(difference_type n, min_pointer x)
+ {
+ return x + n;
+ }
+
+ min_pointer operator-(difference_type n) const
+ {
+ min_pointer tmp(*this);
+ tmp -= n;
+ return tmp;
+ }
+
+ friend difference_type operator-(min_pointer x, min_pointer y)
+ {
+ return x.ptr_ - y.ptr_;
+ }
+
+ reference operator[](difference_type n) const {return ptr_[n];}
+
+ friend bool operator< (min_pointer x, min_pointer y) {return x.ptr_ < y.ptr_;}
+ friend bool operator> (min_pointer x, min_pointer y) {return y < x;}
+ friend bool operator<=(min_pointer x, min_pointer y) {return !(y < x);}
+ friend bool operator>=(min_pointer x, min_pointer y) {return !(x < y);}
+
+ static min_pointer pointer_to(const T& t) {return min_pointer(std::addressof(t));}
+
+ template <class U> friend bool operator==(min_pointer<U>, min_pointer<U>);
+ template <class U> friend class min_pointer;
+};
+
+template <class T>
+inline
+bool
+operator==(min_pointer<T> x, min_pointer<T> y)
+{
+ return x.ptr_ == y.ptr_;
+}
+
+template <class T>
+inline
+bool
+operator!=(min_pointer<T> x, min_pointer<T> y)
+{
+ return !(x == y);
+}
+
+template <class T>
+inline
+bool
+operator==(min_pointer<T> x, std::nullptr_t)
+{
+ return !static_cast<bool>(x);
+}
+
+template <class T>
+inline
+bool
+operator==(std::nullptr_t, min_pointer<T> x)
+{
+ return !static_cast<bool>(x);
+}
+
+template <class T>
+inline
+bool
+operator!=(min_pointer<T> x, std::nullptr_t)
+{
+ return static_cast<bool>(x);
+}
+
+template <class T>
+inline
+bool
+operator!=(std::nullptr_t, min_pointer<T> x)
+{
+ return static_cast<bool>(x);
+}
+
+template <class T>
+class min_allocator
+{
+public:
+ typedef T value_type;
+ typedef min_pointer<T> pointer;
+
+ min_allocator() = default;
+ template <class U>
+ min_allocator(min_allocator<U>) {}
+
+ pointer allocate(std::ptrdiff_t n)
+ {
+ return pointer(static_cast<T*>(::operator new(n*sizeof(T))));
+ }
+
+ void deallocate(pointer p, std::ptrdiff_t)
+ {
+ return ::operator delete(p.ptr_);
+ }
+
+ friend bool operator==(min_allocator, min_allocator) {return true;}
+ friend bool operator!=(min_allocator x, min_allocator y) {return !(x == y);}
+};
+
+#endif // __cplusplus >= 201103L
+
+#endif // MIN_ALLOCATOR_H
OpenPOWER on IntegriCloud