[libcxx] r190474 - LWG Issue #2210 Part 5 - map/multimap; no, really - the last one was set/multiset. THIS is map/multimap
Marshall Clow
mclow.lists at gmail.com
Tue Sep 10 18:15:48 PDT 2013
Author: marshall
Date: Tue Sep 10 20:15:47 2013
New Revision: 190474
URL: http://llvm.org/viewvc/llvm-project?rev=190474&view=rev
Log:
LWG Issue #2210 Part 5 - map/multimap; no, really - the last one was set/multiset. THIS is map/multimap
Modified:
libcxx/trunk/include/map
libcxx/trunk/test/containers/associative/map/map.cons/initializer_list_compare_alloc.pass.cpp
libcxx/trunk/test/containers/associative/map/map.cons/iter_iter_comp_alloc.pass.cpp
libcxx/trunk/test/containers/associative/multimap/multimap.cons/initializer_list_compare_alloc.pass.cpp
libcxx/trunk/test/containers/associative/multimap/multimap.cons/iter_iter.pass.cpp
Modified: libcxx/trunk/include/map
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/map?rev=190474&r1=190473&r2=190474&view=diff
==============================================================================
--- libcxx/trunk/include/map (original)
+++ libcxx/trunk/include/map Tue Sep 10 20:15:47 2013
@@ -77,7 +77,12 @@ public:
map(map&& m, const allocator_type& a);
map(initializer_list<value_type> il, const key_compare& comp = key_compare());
map(initializer_list<value_type> il, const key_compare& comp, const allocator_type& a);
- ~map();
+ template <class InputIterator>
+ map(InputIterator first, InputIterator last, const allocator_type& a)
+ : map(first, last, Compare(), a) {} // C++14
+ map(initializer_list<value_type> il, const allocator_type& a)
+ : map(il, Compare(), a) {} // C++14
+ ~map();
map& operator=(const map& m);
map& operator=(map&& m)
@@ -273,6 +278,11 @@ public:
multimap(initializer_list<value_type> il, const key_compare& comp = key_compare());
multimap(initializer_list<value_type> il, const key_compare& comp,
const allocator_type& a);
+ template <class InputIterator>
+ multimap(InputIterator first, InputIterator last, const allocator_type& a)
+ : multimap(first, last, Compare(), a) {} // C++14
+ multimap(initializer_list<value_type> il, const allocator_type& a)
+ : multimap(il, Compare(), a) {} // C++14
~multimap();
multimap& operator=(const multimap& m);
@@ -827,6 +837,13 @@ public:
insert(__f, __l);
}
+#if _LIBCPP_STD_VER > 11
+ template <class _InputIterator>
+ _LIBCPP_INLINE_VISIBILITY
+ map(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
+ : map(__f, __l, key_compare(), __a) {}
+#endif
+
_LIBCPP_INLINE_VISIBILITY
map(const map& __m)
: __tree_(__m.__tree_)
@@ -885,6 +902,12 @@ public:
insert(__il.begin(), __il.end());
}
+#if _LIBCPP_STD_VER > 11
+ _LIBCPP_INLINE_VISIBILITY
+ map(initializer_list<value_type> __il, const allocator_type& __a)
+ : map(__il, key_compare(), __a) {}
+#endif
+
_LIBCPP_INLINE_VISIBILITY
map& operator=(initializer_list<value_type> __il)
{
@@ -1586,6 +1609,13 @@ public:
insert(__f, __l);
}
+#if _LIBCPP_STD_VER > 11
+ template <class _InputIterator>
+ _LIBCPP_INLINE_VISIBILITY
+ multimap(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
+ : multimap(__f, __l, key_compare(), __a) {}
+#endif
+
_LIBCPP_INLINE_VISIBILITY
multimap(const multimap& __m)
: __tree_(__m.__tree_.value_comp(),
@@ -1645,6 +1675,12 @@ public:
insert(__il.begin(), __il.end());
}
+#if _LIBCPP_STD_VER > 11
+ _LIBCPP_INLINE_VISIBILITY
+ multimap(initializer_list<value_type> __il, const allocator_type& __a)
+ : multimap(__il, key_compare(), __a) {}
+#endif
+
_LIBCPP_INLINE_VISIBILITY
multimap& operator=(initializer_list<value_type> __il)
{
Modified: libcxx/trunk/test/containers/associative/map/map.cons/initializer_list_compare_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/map/map.cons/initializer_list_compare_alloc.pass.cpp?rev=190474&r1=190473&r2=190474&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/map/map.cons/initializer_list_compare_alloc.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/map/map.cons/initializer_list_compare_alloc.pass.cpp Tue Sep 10 20:15:47 2013
@@ -69,6 +69,32 @@ int main()
assert(m.key_comp() == C(3));
assert(m.get_allocator() == A());
}
+#if _LIBCPP_STD_VER > 11
+ {
+ typedef std::pair<const int, double> V;
+ typedef min_allocator<V> A;
+ typedef test_compare<std::less<int> > C;
+ typedef std::map<int, double, C, A> M;
+ A a;
+ M m ({ {1, 1},
+ {1, 1.5},
+ {1, 2},
+ {2, 1},
+ {2, 1.5},
+ {2, 2},
+ {3, 1},
+ {3, 1.5},
+ {3, 2}
+ }, 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.get_allocator() == a);
+ }
+#endif
#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
Modified: libcxx/trunk/test/containers/associative/map/map.cons/iter_iter_comp_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/map/map.cons/iter_iter_comp_alloc.pass.cpp?rev=190474&r1=190473&r2=190474&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/map/map.cons/iter_iter_comp_alloc.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/map/map.cons/iter_iter_comp_alloc.pass.cpp Tue Sep 10 20:15:47 2013
@@ -75,5 +75,34 @@ int main()
assert(*next(m.begin()) == V(2, 1));
assert(*next(m.begin(), 2) == V(3, 1));
}
+#if _LIBCPP_STD_VER > 11
+ {
+ 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 std::pair<const int, double> V;
+ typedef min_allocator<V> A;
+ typedef test_compare<std::less<int> > C;
+ A a;
+ std::map<int, double, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0]), 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.get_allocator() == a);
+ }
+#endif
#endif
}
Modified: libcxx/trunk/test/containers/associative/multimap/multimap.cons/initializer_list_compare_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multimap/multimap.cons/initializer_list_compare_alloc.pass.cpp?rev=190474&r1=190473&r2=190474&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multimap/multimap.cons/initializer_list_compare_alloc.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multimap/multimap.cons/initializer_list_compare_alloc.pass.cpp Tue Sep 10 20:15:47 2013
@@ -92,5 +92,38 @@ int main()
assert(m.key_comp() == Cmp(4));
assert(m.get_allocator() == A());
}
+#if _LIBCPP_STD_VER > 11
+ {
+ typedef test_compare<std::less<int> > C;
+ typedef std::pair<const int, double> V;
+ typedef min_allocator<V> A;
+ typedef std::multimap<int, double, C, A> M;
+ A a;
+ M m ({ {1, 1},
+ {1, 1.5},
+ {1, 2},
+ {2, 1},
+ {2, 1.5},
+ {2, 2},
+ {3, 1},
+ {3, 1.5},
+ {3, 2}
+ }, a);
+
+ assert(m.size() == 9);
+ assert(distance(m.begin(), m.end()) == 9);
+ M::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.get_allocator() == a);
+ }
+#endif
#endif
}
Modified: libcxx/trunk/test/containers/associative/multimap/multimap.cons/iter_iter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multimap/multimap.cons/iter_iter.pass.cpp?rev=190474&r1=190473&r2=190474&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multimap/multimap.cons/iter_iter.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multimap/multimap.cons/iter_iter.pass.cpp Tue Sep 10 20:15:47 2013
@@ -76,5 +76,37 @@ int main()
assert(*next(m.begin(), 7) == V(3, 1.5));
assert(*next(m.begin(), 8) == V(3, 2));
}
+#if _LIBCPP_STD_VER > 11
+ {
+ 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 min_allocator<std::pair<const int, double>> A;
+ A a;
+ std::multimap<int, double, std::less<int>, A> m(ar, ar+sizeof(ar)/sizeof(ar[0]), a);
+ 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(m.get_allocator() == a);
+ }
+#endif
#endif
}
More information about the cfe-commits
mailing list