aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Carlini <pcarlini@suse.de>2007-11-25 18:09:31 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2007-11-25 18:09:31 +0000
commit2839c1513eda51e3992da102f1af6593231d10b8 (patch)
tree0f7c79019493b4af335dc844537c9e9ec65d59be
parent674cdfe554096ad0596ef0d88be678a556c3d438 (diff)
downloadgcc-2839c1513eda51e3992da102f1af6593231d10b8.zip
gcc-2839c1513eda51e3992da102f1af6593231d10b8.tar.gz
gcc-2839c1513eda51e3992da102f1af6593231d10b8.tar.bz2
unordered_map (__unordered_map<>::__unordered_map(__unordered_map&&), [...]): Add in C++0x.
2007-11-25 Paolo Carlini <pcarlini@suse.de> * include/tr1_impl/unordered_map (__unordered_map<>::__unordered_map(__unordered_map&&), __unordered_multimap<>::__unordered_multimap(__unordered_multimap&&), unordered_map<>::unordered_map(unordered_map&&), unordered_multimap<>::unordered_multimap(unordered_multimap&&), unordered_map<>::operator=(unordered_map&&), unordered_multimap<>::operator=(unordered_multimap&&), swap(unordered_map<>&&, unordered_map<>&), swap(unordered_map<>&, unordered_map<>&&), swap(unordered_multimap<>&&, unordered_multimap<>&), swap(unordered_multimap<>&, unordered_multimap<>&&)): Add in C++0x. (swap(unordered_multimap<>&, unordered_multimap<>&), swap(unordered_multimap<>&, unordered_multimap<>&)): Add. * include/tr1_impl/unordered_set (__unordered_set<>::__unordered_set(__unordered_set&&), __unordered_multiset<>::__unordered_multiset(__unordered_multiset&&), unordered_set<>::unordered_set(unordered_setp&&), unordered_multiset<>::unordered_multiset(unordered_multiset&&), unordered_set<>::operator=(unordered_set&&), unordered_multiset<>::operator=(unordered_multiset&&), swap(unordered_set<>&&, unordered_set<>&), swap(unordered_set<>&, unordered_set<>&&), swap(unordered_multiset<>&&, unordered_multiset<>&), swap(unordered_multiset<>&, unordered_multiset<>&&)): Likewise. (swap(unordered_set<>&, unordered_set<>&), swap(unordered_multiset<>&, unordered_multiset<>&)): Add. * include/tr1_impl/hashtable (_Hashtable<>::_Hashtable(_Hashtable&&), swap(_Hashtable&&)): Add in C++0x. * testsuite/23_containers/unordered_map/moveable.cc: New. * testsuite/23_containers/unordered_set/moveable.cc: Likewise. * testsuite/23_containers/unordered_multimap/moveable.cc: Likewise. * testsuite/23_containers/unordered_multiset/moveable.cc: Likewise. From-SVN: r130412
-rw-r--r--libstdc++-v3/ChangeLog35
-rw-r--r--libstdc++-v3/include/tr1_impl/hashtable40
-rw-r--r--libstdc++-v3/include/tr1_impl/unordered_map76
-rw-r--r--libstdc++-v3/include/tr1_impl/unordered_set76
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_map/moveable.cc52
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_multimap/moveable.cc52
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_multiset/moveable.cc52
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_set/moveable.cc52
8 files changed, 434 insertions, 1 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 0688b26..fe86a80 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,5 +1,40 @@
2007-11-25 Paolo Carlini <pcarlini@suse.de>
+ * include/tr1_impl/unordered_map
+ (__unordered_map<>::__unordered_map(__unordered_map&&),
+ __unordered_multimap<>::__unordered_multimap(__unordered_multimap&&),
+ unordered_map<>::unordered_map(unordered_map&&),
+ unordered_multimap<>::unordered_multimap(unordered_multimap&&),
+ unordered_map<>::operator=(unordered_map&&),
+ unordered_multimap<>::operator=(unordered_multimap&&),
+ swap(unordered_map<>&&, unordered_map<>&),
+ swap(unordered_map<>&, unordered_map<>&&),
+ swap(unordered_multimap<>&&, unordered_multimap<>&),
+ swap(unordered_multimap<>&, unordered_multimap<>&&)): Add in C++0x.
+ (swap(unordered_multimap<>&, unordered_multimap<>&),
+ swap(unordered_multimap<>&, unordered_multimap<>&)): Add.
+ * include/tr1_impl/unordered_set
+ (__unordered_set<>::__unordered_set(__unordered_set&&),
+ __unordered_multiset<>::__unordered_multiset(__unordered_multiset&&),
+ unordered_set<>::unordered_set(unordered_setp&&),
+ unordered_multiset<>::unordered_multiset(unordered_multiset&&),
+ unordered_set<>::operator=(unordered_set&&),
+ unordered_multiset<>::operator=(unordered_multiset&&),
+ swap(unordered_set<>&&, unordered_set<>&),
+ swap(unordered_set<>&, unordered_set<>&&),
+ swap(unordered_multiset<>&&, unordered_multiset<>&),
+ swap(unordered_multiset<>&, unordered_multiset<>&&)): Likewise.
+ (swap(unordered_set<>&, unordered_set<>&),
+ swap(unordered_multiset<>&, unordered_multiset<>&)): Add.
+ * include/tr1_impl/hashtable (_Hashtable<>::_Hashtable(_Hashtable&&),
+ swap(_Hashtable&&)): Add in C++0x.
+ * testsuite/23_containers/unordered_map/moveable.cc: New.
+ * testsuite/23_containers/unordered_set/moveable.cc: Likewise.
+ * testsuite/23_containers/unordered_multimap/moveable.cc: Likewise.
+ * testsuite/23_containers/unordered_multiset/moveable.cc: Likewise.
+
+2007-11-25 Paolo Carlini <pcarlini@suse.de>
+
* include/tr1_impl/array (array<>::_M_check): Remove, not necessary
anymore.
(array<>::at): Adjust.
diff --git a/libstdc++-v3/include/tr1_impl/hashtable b/libstdc++-v3/include/tr1_impl/hashtable
index 093af39..0efe652 100644
--- a/libstdc++-v3/include/tr1_impl/hashtable
+++ b/libstdc++-v3/include/tr1_impl/hashtable
@@ -217,13 +217,21 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
const allocator_type&);
_Hashtable(const _Hashtable&);
+
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ _Hashtable(_Hashtable&&);
+#endif
_Hashtable&
operator=(const _Hashtable&);
-
+
~_Hashtable();
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ void swap(_Hashtable&&);
+#else
void swap(_Hashtable&);
+#endif
// Basic container operations
iterator
@@ -641,6 +649,32 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
}
}
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ template<typename _Key, typename _Value,
+ typename _Allocator, typename _ExtractKey, typename _Equal,
+ typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
+ bool __chc, bool __cit, bool __uk>
+ _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
+ _Hashtable(_Hashtable&& __ht)
+ : __detail::_Rehash_base<_RehashPolicy, _Hashtable>(__ht),
+ __detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, __chc>(__ht),
+ __detail::_Map_base<_Key, _Value, _ExtractKey, __uk, _Hashtable>(__ht),
+ _M_node_allocator(__ht._M_node_allocator),
+ _M_bucket_count(__ht._M_bucket_count),
+ _M_element_count(__ht._M_element_count),
+ _M_rehash_policy(__ht._M_rehash_policy),
+ _M_buckets(__ht._M_buckets)
+ {
+ size_type __n_bkt = __ht._M_rehash_policy._M_next_bkt(0);
+ __ht._M_buckets = __ht._M_allocate_buckets(__n_bkt);
+ __ht._M_bucket_count = __n_bkt;
+ __ht._M_element_count = 0;
+ __ht._M_rehash_policy = _RehashPolicy();
+ }
+#endif
+
template<typename _Key, typename _Value,
typename _Allocator, typename _ExtractKey, typename _Equal,
typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
@@ -675,7 +709,11 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
void
_Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
_H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ swap(_Hashtable&& __x)
+#else
swap(_Hashtable& __x)
+#endif
{
// The only base class with member variables is hash_code_base. We
// define _Hash_code_base::_M_swap because different specializations
diff --git a/libstdc++-v3/include/tr1_impl/unordered_map b/libstdc++-v3/include/tr1_impl/unordered_map
index a362296..5ecd5c0 100644
--- a/libstdc++-v3/include/tr1_impl/unordered_map
+++ b/libstdc++-v3/include/tr1_impl/unordered_map
@@ -85,6 +85,11 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
__detail::_Default_ranged_hash(),
__eql, std::_Select1st<std::pair<const _Key, _Tp> >(), __a)
{ }
+
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ __unordered_map(__unordered_map&& __x)
+ : _Base(std::forward<_Base>(__x)) { }
+#endif
};
template<class _Key, class _Tp,
@@ -137,6 +142,11 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
__detail::_Default_ranged_hash(),
__eql, std::_Select1st<std::pair<const _Key, _Tp> >(), __a)
{ }
+
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ __unordered_multimap(__unordered_multimap&& __x)
+ : _Base(std::forward<_Base>(__x)) { }
+#endif
};
template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc,
@@ -189,6 +199,20 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
const allocator_type& __a = allocator_type())
: _Base(__f, __l, __n, __hf, __eql, __a)
{ }
+
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ unordered_map(unordered_map&& __x)
+ : _Base(std::forward<_Base>(__x)) { }
+
+ unordered_map&
+ operator=(unordered_map&& __x)
+ {
+ // NB: DR 675.
+ this->clear();
+ this->swap(__x);
+ return *this;
+ }
+#endif
};
template<class _Key, class _Tp,
@@ -223,7 +247,59 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
const allocator_type& __a = allocator_type())
: _Base(__f, __l, __n, __hf, __eql, __a)
{ }
+
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ unordered_multimap(unordered_multimap&& __x)
+ : _Base(std::forward<_Base>(__x)) { }
+
+ unordered_multimap&
+ operator=(unordered_multimap&& __x)
+ {
+ // NB: DR 675.
+ this->clear();
+ this->swap(__x);
+ return *this;
+ }
+#endif
};
+ template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+ inline void
+ swap(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
+ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
+ { __x.swap(__y); }
+
+ template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+ inline void
+ swap(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
+ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
+ { __x.swap(__y); }
+
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+ inline void
+ swap(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>&& __x,
+ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
+ { __x.swap(__y); }
+
+ template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+ inline void
+ swap(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
+ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>&& __y)
+ { __x.swap(__y); }
+
+ template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+ inline void
+ swap(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>&& __x,
+ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
+ { __x.swap(__y); }
+
+ template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+ inline void
+ swap(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
+ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>&& __y)
+ { __x.swap(__y); }
+#endif
+
_GLIBCXX_END_NAMESPACE_TR1
}
diff --git a/libstdc++-v3/include/tr1_impl/unordered_set b/libstdc++-v3/include/tr1_impl/unordered_set
index 2292d36..bdc1575 100644
--- a/libstdc++-v3/include/tr1_impl/unordered_set
+++ b/libstdc++-v3/include/tr1_impl/unordered_set
@@ -85,6 +85,11 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
__detail::_Default_ranged_hash(), __eql,
std::_Identity<_Value>(), __a)
{ }
+
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ __unordered_set(__unordered_set&& __x)
+ : _Base(std::forward<_Base>(__x)) { }
+#endif
};
template<class _Value,
@@ -135,6 +140,11 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
__detail::_Default_ranged_hash(), __eql,
std::_Identity<_Value>(), __a)
{ }
+
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ __unordered_multiset(__unordered_multiset&& __x)
+ : _Base(std::forward<_Base>(__x)) { }
+#endif
};
template<class _Value, class _Hash, class _Pred, class _Alloc,
@@ -187,6 +197,20 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
const allocator_type& __a = allocator_type())
: _Base(__f, __l, __n, __hf, __eql, __a)
{ }
+
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ unordered_set(unordered_set&& __x)
+ : _Base(std::forward<_Base>(__x)) { }
+
+ unordered_set&
+ operator=(unordered_set&& __x)
+ {
+ // NB: DR 675.
+ this->clear();
+ this->swap(__x);
+ return *this;
+ }
+#endif
};
template<class _Value,
@@ -221,7 +245,59 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
const allocator_type& __a = allocator_type())
: _Base(__f, __l, __n, __hf, __eql, __a)
{ }
+
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ unordered_multiset(unordered_multiset&& __x)
+ : _Base(std::forward<_Base>(__x)) { }
+
+ unordered_multiset&
+ operator=(unordered_multiset&& __x)
+ {
+ // NB: DR 675.
+ this->clear();
+ this->swap(__x);
+ return *this;
+ }
+#endif
};
+ template<class _Value, class _Hash, class _Pred, class _Alloc>
+ inline void
+ swap(unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
+ unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
+ { __x.swap(__y); }
+
+ template<class _Value, class _Hash, class _Pred, class _Alloc>
+ inline void
+ swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
+ unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
+ { __x.swap(__y); }
+
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ template<class _Value, class _Hash, class _Pred, class _Alloc>
+ inline void
+ swap(unordered_set<_Value, _Hash, _Pred, _Alloc>&& __x,
+ unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
+ { __x.swap(__y); }
+
+ template<class _Value, class _Hash, class _Pred, class _Alloc>
+ inline void
+ swap(unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
+ unordered_set<_Value, _Hash, _Pred, _Alloc>&& __y)
+ { __x.swap(__y); }
+
+ template<class _Value, class _Hash, class _Pred, class _Alloc>
+ inline void
+ swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>&& __x,
+ unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
+ { __x.swap(__y); }
+
+ template<class _Value, class _Hash, class _Pred, class _Alloc>
+ inline void
+ swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
+ unordered_multiset<_Value, _Hash, _Pred, _Alloc>&& __y)
+ { __x.swap(__y); }
+#endif
+
_GLIBCXX_END_NAMESPACE_TR1
}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/moveable.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/moveable.cc
new file mode 100644
index 0000000..4032a74
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/moveable.cc
@@ -0,0 +1,52 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// NOTE: This makes use of the fact that we know how moveable
+// is implemented on map (via swap). If the implementation changed
+// this test may begin to fail.
+
+#include <unordered_map>
+#include <utility>
+#include <testsuite_hooks.h>
+
+int main()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::unordered_map<int, int> a,b;
+ a[2]=0;
+ b[1]=0;
+ b = std::move(a);
+ VERIFY( b.find(2) != b.end() && a.find(1) == a.end() );
+
+ std::unordered_map<int, int> c(std::move(b));
+ VERIFY( c.find(2) != c.end() );
+ VERIFY( b.find(2) == b.end() );
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/moveable.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/moveable.cc
new file mode 100644
index 0000000..96e420b
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/moveable.cc
@@ -0,0 +1,52 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// NOTE: This makes use of the fact that we know how moveable
+// is implemented on multimap (via swap). If the implementation changed
+// this test may begin to fail.
+
+#include <unordered_map>
+#include <utility>
+#include <testsuite_hooks.h>
+
+int main()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::unordered_multimap<int, int> a,b;
+ a.insert(std::make_pair(2,0));
+ b.insert(std::make_pair(1,0));
+ b = std::move(a);
+ VERIFY( b.find(2) != b.end() && a.find(1) == a.end() );
+
+ std::unordered_multimap<int, int> c(std::move(b));
+ VERIFY( c.find(2) != c.end() );
+ VERIFY( b.find(2) == b.end() );
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/moveable.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/moveable.cc
new file mode 100644
index 0000000..baa35a9
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/moveable.cc
@@ -0,0 +1,52 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// NOTE: This makes use of the fact that we know how moveable
+// is implemented on set (via swap). If the implementation changed
+// this test may begin to fail.
+
+#include <unordered_set>
+#include <utility>
+#include <testsuite_hooks.h>
+
+int main()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::unordered_multiset<int> a,b;
+ a.insert(2);
+ b.insert(1);
+ b = std::move(a);
+ VERIFY( b.find(2) != b.end() && a.find(1) == a.end() );
+
+ std::unordered_multiset<int> c(std::move(b));
+ VERIFY( c.find(2) != c.end() );
+ VERIFY( b.find(2) == b.end() );
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/moveable.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/moveable.cc
new file mode 100644
index 0000000..a67e942
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_set/moveable.cc
@@ -0,0 +1,52 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// NOTE: This makes use of the fact that we know how moveable
+// is implemented on set (via swap). If the implementation changed
+// this test may begin to fail.
+
+#include <unordered_set>
+#include <utility>
+#include <testsuite_hooks.h>
+
+int main()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::unordered_set<int> a,b;
+ a.insert(2);
+ b.insert(1);
+ b = std::move(a);
+ VERIFY( b.find(2) != b.end() && a.find(1) == a.end() );
+
+ std::unordered_set<int> c(std::move(b));
+ VERIFY( c.find(2) != c.end() );
+ VERIFY( b.find(2) == b.end() );
+ return 0;
+}