[libcxx] r190454 - LWG Issue #2210 Part 4 - map/multimap
Marshall Clow
mclow.lists at gmail.com
Tue Sep 10 17:06:45 PDT 2013
Author: marshall
Date: Tue Sep 10 19:06:45 2013
New Revision: 190454
URL: http://llvm.org/viewvc/llvm-project?rev=190454&view=rev
Log:
LWG Issue #2210 Part 4 - map/multimap
Modified:
libcxx/trunk/include/set
libcxx/trunk/test/containers/associative/multiset/multiset.cons/initializer_list.pass.cpp
libcxx/trunk/test/containers/associative/multiset/multiset.cons/iter_iter_alloc.pass.cpp
libcxx/trunk/test/containers/associative/set/set.cons/initializer_list_compare_alloc.pass.cpp
libcxx/trunk/test/containers/associative/set/set.cons/iter_iter_alloc.pass.cpp
Modified: libcxx/trunk/include/set
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/set?rev=190454&r1=190453&r2=190454&view=diff
==============================================================================
--- libcxx/trunk/include/set (original)
+++ libcxx/trunk/include/set Tue Sep 10 19:06:45 2013
@@ -66,6 +66,11 @@ public:
set(initializer_list<value_type> il, const value_compare& comp = value_compare());
set(initializer_list<value_type> il, const value_compare& comp,
const allocator_type& a);
+ template <class InputIterator>
+ set(InputIterator first, InputIterator last, const allocator_type& a)
+ : set(first, last, Compare(), a) {} // C++14
+ set(initializer_list<value_type> il, const allocator_type& a)
+ : set(il, Compare(), a) {} // C++14
~set();
set& operator=(const set& s);
@@ -242,6 +247,11 @@ public:
multiset(initializer_list<value_type> il, const value_compare& comp = value_compare());
multiset(initializer_list<value_type> il, const value_compare& comp,
const allocator_type& a);
+ template <class InputIterator>
+ multiset(InputIterator first, InputIterator last, const allocator_type& a)
+ : set(first, last, Compare(), a) {} // C++14
+ multiset(initializer_list<value_type> il, const allocator_type& a)
+ : set(il, Compare(), a) {} // C++14
~multiset();
multiset& operator=(const multiset& s);
@@ -442,6 +452,13 @@ public:
insert(__f, __l);
}
+#if _LIBCPP_STD_VER > 11
+ template <class _InputIterator>
+ _LIBCPP_INLINE_VISIBILITY
+ set(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
+ : set(__f, __l, key_compare(), __a) {}
+#endif
+
_LIBCPP_INLINE_VISIBILITY
set(const set& __s)
: __tree_(__s.__tree_)
@@ -494,6 +511,12 @@ public:
insert(__il.begin(), __il.end());
}
+#if _LIBCPP_STD_VER > 11
+ _LIBCPP_INLINE_VISIBILITY
+ set(initializer_list<value_type> __il, const allocator_type& __a)
+ : set(__il, key_compare(), __a) {}
+#endif
+
_LIBCPP_INLINE_VISIBILITY
set& operator=(initializer_list<value_type> __il)
{
@@ -817,6 +840,13 @@ public:
insert(__f, __l);
}
+#if _LIBCPP_STD_VER > 11
+ template <class _InputIterator>
+ _LIBCPP_INLINE_VISIBILITY
+ multiset(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
+ : multiset(__f, __l, key_compare(), __a) {}
+#endif
+
template <class _InputIterator>
_LIBCPP_INLINE_VISIBILITY
multiset(_InputIterator __f, _InputIterator __l,
@@ -876,6 +906,12 @@ public:
insert(__il.begin(), __il.end());
}
+#if _LIBCPP_STD_VER > 11
+ _LIBCPP_INLINE_VISIBILITY
+ multiset(initializer_list<value_type> __il, const allocator_type& __a)
+ : multiset(__il, key_compare(), __a) {}
+#endif
+
_LIBCPP_INLINE_VISIBILITY
multiset& operator=(initializer_list<value_type> __il)
{
Modified: libcxx/trunk/test/containers/associative/multiset/multiset.cons/initializer_list.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multiset/multiset.cons/initializer_list.pass.cpp?rev=190454&r1=190453&r2=190454&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multiset/multiset.cons/initializer_list.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multiset/multiset.cons/initializer_list.pass.cpp Tue Sep 10 19:06:45 2013
@@ -51,5 +51,23 @@ int main()
assert(*++i == V(5));
assert(*++i == V(6));
}
+#if _LIBCPP_STD_VER > 11
+ {
+ typedef std::multiset<int, std::less<int>, min_allocator<int>> C;
+ typedef C::value_type V;
+ min_allocator<int> a;
+ C m ({1, 2, 3, 4, 5, 6}, a);
+ 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));
+ assert(m.get_allocator() == a);
+ }
+#endif
#endif
}
Modified: libcxx/trunk/test/containers/associative/multiset/multiset.cons/iter_iter_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/multiset/multiset.cons/iter_iter_alloc.pass.cpp?rev=190454&r1=190453&r2=190454&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/multiset/multiset.cons/iter_iter_alloc.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/multiset/multiset.cons/iter_iter_alloc.pass.cpp Tue Sep 10 19:06:45 2013
@@ -55,4 +55,38 @@ int main()
assert(*next(m.begin(), 6) == 3);
assert(*next(m.begin(), 7) == 3);
assert(*next(m.begin(), 8) == 3);
+#if _LIBCPP_STD_VER > 11
+ {
+ typedef int V;
+ V ar[] =
+ {
+ 1,
+ 1,
+ 1,
+ 2,
+ 2,
+ 2,
+ 3,
+ 3,
+ 3
+ };
+ typedef test_allocator<V> A;
+ typedef test_compare<std::less<int> > C;
+ A a;
+ std::multiset<V, C, A> m(ar, ar+sizeof(ar)/sizeof(ar[0]), a);
+
+ 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(m.get_allocator() == a);
+ }
+#endif
}
Modified: libcxx/trunk/test/containers/associative/set/set.cons/initializer_list_compare_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/set/set.cons/initializer_list_compare_alloc.pass.cpp?rev=190454&r1=190453&r2=190454&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/set/set.cons/initializer_list_compare_alloc.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/set/set.cons/initializer_list_compare_alloc.pass.cpp Tue Sep 10 19:06:45 2013
@@ -12,6 +12,7 @@
// class set
// set(initializer_list<value_type> il, const key_compare& comp, const allocator_type& a);
+// set(initializer_list<value_type> il, const allocator_type& a);
#include <set>
#include <cassert>
@@ -21,6 +22,7 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ {
typedef test_compare<std::less<int> > Cmp;
typedef test_allocator<int> A;
typedef std::set<int, Cmp, A> C;
@@ -37,5 +39,25 @@ int main()
assert(*++i == V(6));
assert(m.key_comp() == Cmp(10));
assert(m.get_allocator() == A(4));
+ }
+#if _LIBCPP_STD_VER > 11
+ {
+ typedef test_compare<std::less<int> > Cmp;
+ typedef test_allocator<int> A;
+ typedef std::set<int, Cmp, A> C;
+ typedef C::value_type V;
+ C m({1, 2, 3, 4, 5, 6}, A(4));
+ 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));
+ assert(m.get_allocator() == A(4));
+ }
+#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
Modified: libcxx/trunk/test/containers/associative/set/set.cons/iter_iter_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/associative/set/set.cons/iter_iter_alloc.pass.cpp?rev=190454&r1=190453&r2=190454&view=diff
==============================================================================
--- libcxx/trunk/test/containers/associative/set/set.cons/iter_iter_alloc.pass.cpp (original)
+++ libcxx/trunk/test/containers/associative/set/set.cons/iter_iter_alloc.pass.cpp Tue Sep 10 19:06:45 2013
@@ -14,6 +14,10 @@
// template <class InputIterator>
// set(InputIterator first, InputIterator last,
// const value_compare& comp, const allocator_type& a);
+//
+// template <class InputIterator>
+// set(InputIterator first, InputIterator last,
+// const allocator_type& a);
#include <set>
#include <cassert>
@@ -49,4 +53,32 @@ int main()
assert(*m.begin() == 1);
assert(*next(m.begin()) == 2);
assert(*next(m.begin(), 2) == 3);
+#if _LIBCPP_STD_VER > 11
+ {
+ typedef int V;
+ V ar[] =
+ {
+ 1,
+ 1,
+ 1,
+ 2,
+ 2,
+ 2,
+ 3,
+ 3,
+ 3
+ };
+ typedef test_allocator<V> A;
+ typedef test_compare<std::less<int> > C;
+ A a(7);
+ std::set<V, 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() == 1);
+ assert(*next(m.begin()) == 2);
+ assert(*next(m.begin(), 2) == 3);
+ assert(m.get_allocator() == a);
+ }
+#endif
}
More information about the cfe-commits
mailing list