From 8ed13e2757455db9dadc4c20dbf1a4aad3663004 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Thu, 14 Nov 2013 12:43:00 +0000 Subject: [PATCH] alloc_traits.h (__allow_copy_cons): Remove. * include/bits/alloc_traits.h (__allow_copy_cons): Remove. (__check_copy_constructible): Likewise. * include/bits/unordered_map.h (unordered_map, unordered_multimap): Do not derive from __check_copy_constructible. * include/bits/unordered_set.h (unordered_set, unordered_multiset): Likewise. * testsuite/23_containers/unordered_map/55043.cc: It is no longer necessary for is_copy_constructible to be correct to use nested unordered containers. * testsuite/23_containers/unordered_multimap/55043.cc: Likewise. * testsuite/23_containers/unordered_set/55043.cc: Likewise. * testsuite/23_containers/unordered_multiset/55043.cc: Likewise. From-SVN: r204790 --- libstdc++-v3/ChangeLog | 15 +++++++++++++ libstdc++-v3/include/bits/alloc_traits.h | 18 --------------- libstdc++-v3/include/bits/unordered_map.h | 4 ++-- libstdc++-v3/include/bits/unordered_set.h | 4 ++-- .../testsuite/23_containers/unordered_map/55043.cc | 25 --------------------- .../23_containers/unordered_multimap/55043.cc | 26 ---------------------- .../23_containers/unordered_multiset/55043.cc | 26 ---------------------- .../testsuite/23_containers/unordered_set/55043.cc | 26 ---------------------- 8 files changed, 19 insertions(+), 125 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 5abe56e..384fb21 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,18 @@ +2013-11-14 Jonathan Wakely + + * include/bits/alloc_traits.h (__allow_copy_cons): Remove. + (__check_copy_constructible): Likewise. + * include/bits/unordered_map.h (unordered_map, unordered_multimap): + Do not derive from __check_copy_constructible. + * include/bits/unordered_set.h (unordered_set, unordered_multiset): + Likewise. + * testsuite/23_containers/unordered_map/55043.cc: It is no longer + necessary for is_copy_constructible to be correct to use nested + unordered containers. + * testsuite/23_containers/unordered_multimap/55043.cc: Likewise. + * testsuite/23_containers/unordered_set/55043.cc: Likewise. + * testsuite/23_containers/unordered_multiset/55043.cc: Likewise. + 2013-11-13 Marc Glisse PR libstdc++/59087 diff --git a/libstdc++-v3/include/bits/alloc_traits.h b/libstdc++-v3/include/bits/alloc_traits.h index e68d317..815c4b8 100644 --- a/libstdc++-v3/include/bits/alloc_traits.h +++ b/libstdc++-v3/include/bits/alloc_traits.h @@ -541,24 +541,6 @@ _GLIBCXX_ALLOC_TR_NESTED_TYPE(propagate_on_container_swap, : is_copy_constructible<_Tp> { }; - // Used to allow copy construction of unordered containers - template struct __allow_copy_cons { }; - - // Used to delete copy constructor of unordered containers - template<> - struct __allow_copy_cons - { - __allow_copy_cons() = default; - __allow_copy_cons(const __allow_copy_cons&) = delete; - __allow_copy_cons(__allow_copy_cons&&) = default; - __allow_copy_cons& operator=(const __allow_copy_cons&) = default; - __allow_copy_cons& operator=(__allow_copy_cons&&) = default; - }; - - template - using __check_copy_constructible - = __allow_copy_cons<__is_copy_insertable<_Alloc>::value>; - _GLIBCXX_END_NAMESPACE_VERSION } // namespace std diff --git a/libstdc++-v3/include/bits/unordered_map.h b/libstdc++-v3/include/bits/unordered_map.h index 6d5b29e..a1b99ac 100644 --- a/libstdc++-v3/include/bits/unordered_map.h +++ b/libstdc++-v3/include/bits/unordered_map.h @@ -95,7 +95,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER class _Hash = hash<_Key>, class _Pred = std::equal_to<_Key>, class _Alloc = std::allocator > > - class unordered_map : __check_copy_constructible<_Alloc> + class unordered_map { typedef __umap_hashtable<_Key, _Tp, _Hash, _Pred, _Alloc> _Hashtable; _Hashtable _M_h; @@ -807,7 +807,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER class _Hash = hash<_Key>, class _Pred = std::equal_to<_Key>, class _Alloc = std::allocator > > - class unordered_multimap : __check_copy_constructible<_Alloc> + class unordered_multimap { typedef __ummap_hashtable<_Key, _Tp, _Hash, _Pred, _Alloc> _Hashtable; _Hashtable _M_h; diff --git a/libstdc++-v3/include/bits/unordered_set.h b/libstdc++-v3/include/bits/unordered_set.h index 89deb49..22bddec 100644 --- a/libstdc++-v3/include/bits/unordered_set.h +++ b/libstdc++-v3/include/bits/unordered_set.h @@ -90,7 +90,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER class _Hash = hash<_Value>, class _Pred = std::equal_to<_Value>, class _Alloc = std::allocator<_Value> > - class unordered_set : __check_copy_constructible<_Alloc> + class unordered_set { typedef __uset_hashtable<_Value, _Hash, _Pred, _Alloc> _Hashtable; _Hashtable _M_h; @@ -725,7 +725,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER class _Hash = hash<_Value>, class _Pred = std::equal_to<_Value>, class _Alloc = std::allocator<_Value> > - class unordered_multiset : __check_copy_constructible<_Alloc> + class unordered_multiset { typedef __umset_hashtable<_Value, _Hash, _Pred, _Alloc> _Hashtable; _Hashtable _M_h; diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/55043.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/55043.cc index 50e5437..baef785 100644 --- a/libstdc++-v3/testsuite/23_containers/unordered_map/55043.cc +++ b/libstdc++-v3/testsuite/23_containers/unordered_map/55043.cc @@ -42,28 +42,3 @@ void test01() v.emplace_back(uim()); } -// Unordered containers don't use allocator_traits yet so need full -// Allocator interface, derive from std::allocator to get it. -template -struct Alloc : std::allocator -{ - template - struct rebind { typedef Alloc other; }; - - Alloc() = default; - - template - Alloc(const Alloc&) { } - - typedef typename std::conditional::type arg_type; - - void construct(T* p, arg_type) const - { new((void*)p) T(); } -}; - -// verify is_copy_constructible depends on allocator -typedef test_type> uim_rval; -static_assert(!std::is_copy_constructible::value, "is not copyable"); - -typedef test_type> uim_lval; -static_assert(std::is_copy_constructible::value, "is copyable"); diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/55043.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/55043.cc index afeecaa..224e660 100644 --- a/libstdc++-v3/testsuite/23_containers/unordered_multimap/55043.cc +++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/55043.cc @@ -41,29 +41,3 @@ void test01() std::vector v; v.emplace_back(uim()); } - -// Unordered containers don't use allocator_traits yet so need full -// Allocator interface, derive from std::allocator to get it. -template -struct Alloc : std::allocator -{ - template - struct rebind { typedef Alloc other; }; - - Alloc() = default; - - template - Alloc(const Alloc&) { } - - typedef typename std::conditional::type arg_type; - - void construct(T* p, arg_type) const - { new((void*)p) T(); } -}; - -// verify is_copy_constructible depends on allocator -typedef test_type> uim_rval; -static_assert(!std::is_copy_constructible::value, "is not copyable"); - -typedef test_type> uim_lval; -static_assert(std::is_copy_constructible::value, "is copyable"); diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/55043.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/55043.cc index c80ce55..ed9da39 100644 --- a/libstdc++-v3/testsuite/23_containers/unordered_multiset/55043.cc +++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/55043.cc @@ -45,29 +45,3 @@ void test01() std::vector v; v.emplace_back(uim()); } - -// Unordered containers don't use allocator_traits yet so need full -// Allocator interface, derive from std::allocator to get it. -template -struct Alloc : std::allocator -{ - template - struct rebind { typedef Alloc other; }; - - Alloc() = default; - - template - Alloc(const Alloc&) { } - - typedef typename std::conditional::type arg_type; - - void construct(T* p, arg_type) const - { new((void*)p) T(); } -}; - -// verify is_copy_constructible depends on allocator -typedef test_type> uim_rval; -static_assert(!std::is_copy_constructible::value, "is not copyable"); - -typedef test_type> uim_lval; -static_assert(std::is_copy_constructible::value, "is copyable"); diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/55043.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/55043.cc index 1524890..3a02226 100644 --- a/libstdc++-v3/testsuite/23_containers/unordered_set/55043.cc +++ b/libstdc++-v3/testsuite/23_containers/unordered_set/55043.cc @@ -45,29 +45,3 @@ void test01() std::vector v; v.emplace_back(uim()); } - -// Unordered containers don't use allocator_traits yet so need full -// Allocator interface, derive from std::allocator to get it. -template -struct Alloc : std::allocator -{ - template - struct rebind { typedef Alloc other; }; - - Alloc() = default; - - template - Alloc(const Alloc&) { } - - typedef typename std::conditional::type arg_type; - - void construct(T* p, arg_type) const - { new((void*)p) T(); } -}; - -// verify is_copy_constructible depends on allocator -typedef test_type> uim_rval; -static_assert(!std::is_copy_constructible::value, "is not copyable"); - -typedef test_type> uim_lval; -static_assert(std::is_copy_constructible::value, "is copyable"); -- 2.7.4