aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Carlini <paolo@gcc.gnu.org>2007-10-08 11:16:51 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2007-10-08 11:16:51 +0000
commit6c5f0578d9ba4296583e0f77201d42d259f06128 (patch)
tree5578085e8f7dedc9a64ed2c3724e977ca1d841b6
parentf019adc11693d991cd68e086c04e124fab610c4c (diff)
downloadgcc-6c5f0578d9ba4296583e0f77201d42d259f06128.zip
gcc-6c5f0578d9ba4296583e0f77201d42d259f06128.tar.gz
gcc-6c5f0578d9ba4296583e0f77201d42d259f06128.tar.bz2
[multiple changes]
2007-10-08 Paolo Carlini <pcarlini@suse.de> * include/std/utility (identity, move, forward): Move to... * include/bits/stl_move.h: ... here. * include/Makefile.am: Add. * include/bits/stl_algobase.h: Include the latter. * include/Makefile.in: Regenerate. * testsuite/20_util/pair/moveable.cc: Remove dg-require-rvalref. 2007-10-08 Chris Jefferson <chris@bubblescope.net> Paolo Carlini <pcarlini@suse.de> * include/bits/stl_pair.h (pair<>:pair(pair&&), pair<>::operator=(pair&&)): Add. From-SVN: r129123
-rw-r--r--libstdc++-v3/ChangeLog15
-rw-r--r--libstdc++-v3/include/Makefile.am1
-rw-r--r--libstdc++-v3/include/Makefile.in1
-rw-r--r--libstdc++-v3/include/bits/stl_algobase.h2
-rw-r--r--libstdc++-v3/include/bits/stl_pair.h18
-rw-r--r--libstdc++-v3/include/std/utility25
-rw-r--r--libstdc++-v3/testsuite/20_util/pair/moveable.cc1
7 files changed, 37 insertions, 26 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 356b8d1b..9b41330 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,18 @@
+2007-10-08 Paolo Carlini <pcarlini@suse.de>
+
+ * include/std/utility (identity, move, forward): Move to...
+ * include/bits/stl_move.h: ... here.
+ * include/Makefile.am: Add.
+ * include/bits/stl_algobase.h: Include the latter.
+ * include/Makefile.in: Regenerate.
+ * testsuite/20_util/pair/moveable.cc: Remove dg-require-rvalref.
+
+2007-10-08 Chris Jefferson <chris@bubblescope.net>
+ Paolo Carlini <pcarlini@suse.de>
+
+ * include/bits/stl_pair.h (pair<>:pair(pair&&),
+ pair<>::operator=(pair&&)): Add.
+
2007-10-07 Chris Jefferson <chris@bubblescope.net>
Paolo Carlini <pcarlini@suse.de>
diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am
index 017ffcb..2e2609c 100644
--- a/libstdc++-v3/include/Makefile.am
+++ b/libstdc++-v3/include/Makefile.am
@@ -120,6 +120,7 @@ bits_headers = \
${bits_srcdir}/stl_list.h \
${bits_srcdir}/stl_map.h \
${bits_srcdir}/stl_auto_ptr.h \
+ ${bits_srcdir}/stl_move.h \
${bits_srcdir}/stl_multimap.h \
${bits_srcdir}/stl_multiset.h \
${bits_srcdir}/stl_numeric.h \
diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in
index 0558c66..d1db21d 100644
--- a/libstdc++-v3/include/Makefile.in
+++ b/libstdc++-v3/include/Makefile.in
@@ -369,6 +369,7 @@ bits_headers = \
${bits_srcdir}/stl_list.h \
${bits_srcdir}/stl_map.h \
${bits_srcdir}/stl_auto_ptr.h \
+ ${bits_srcdir}/stl_move.h \
${bits_srcdir}/stl_multimap.h \
${bits_srcdir}/stl_multiset.h \
${bits_srcdir}/stl_numeric.h \
diff --git a/libstdc++-v3/include/bits/stl_algobase.h b/libstdc++-v3/include/bits/stl_algobase.h
index e0e2850..9d055fc 100644
--- a/libstdc++-v3/include/bits/stl_algobase.h
+++ b/libstdc++-v3/include/bits/stl_algobase.h
@@ -75,7 +75,7 @@
#include <debug/debug.h>
#ifdef __GXX_EXPERIMENTAL_CXX0X__
-# include <utility>
+# include <bits/stl_move.h>
# define _GLIBCXX_MOVE(_Tp) std::move(_Tp)
#else
# define _GLIBCXX_MOVE(_Tp) _Tp
diff --git a/libstdc++-v3/include/bits/stl_pair.h b/libstdc++-v3/include/bits/stl_pair.h
index bdc6723..9740526 100644
--- a/libstdc++-v3/include/bits/stl_pair.h
+++ b/libstdc++-v3/include/bits/stl_pair.h
@@ -62,6 +62,10 @@
#ifndef _STL_PAIR_H
#define _STL_PAIR_H 1
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+#include <bits/stl_move.h>
+#endif
+
_GLIBCXX_BEGIN_NAMESPACE(std)
/// pair holds two objects of arbitrary type.
@@ -89,6 +93,20 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
template<class _U1, class _U2>
pair(const pair<_U1, _U2>& __p)
: first(__p.first), second(__p.second) { }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ pair(pair&& __p)
+ : first(std::move(__p.first)),
+ second(std::move(__p.second)) { }
+
+ pair&
+ operator=(pair&& __p)
+ {
+ first = std::move(__p.first);
+ second = std::move(__p.second);
+ return *this;
+ }
+#endif
};
/// Two pairs of the same type are equal iff their members are equal.
diff --git a/libstdc++-v3/include/std/utility b/libstdc++-v3/include/std/utility
index 5020b95..67e4b73 100644
--- a/libstdc++-v3/include/std/utility
+++ b/libstdc++-v3/include/std/utility
@@ -84,30 +84,7 @@
# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
# undef _GLIBCXX_INCLUDE_AS_CXX0X
# endif
-
-#include <type_traits>
-
-_GLIBCXX_BEGIN_NAMESPACE(std)
-
- // 20.2.2, forward/move
- template<typename _Tp>
- struct identity
- {
- typedef _Tp type;
- };
-
- template<typename _Tp>
- inline _Tp&&
- forward(typename std::identity<_Tp>::type&& __t)
- { return __t; }
-
- template<typename _Tp>
- inline typename std::remove_reference<_Tp>::type&&
- move(_Tp&& __t)
- { return __t; }
-
-_GLIBCXX_END_NAMESPACE
-
+# include <bits/stl_move.h>
#endif
#endif /* _GLIBCXX_UTILITY */
diff --git a/libstdc++-v3/testsuite/20_util/pair/moveable.cc b/libstdc++-v3/testsuite/20_util/pair/moveable.cc
index 8a0e593..e843210 100644
--- a/libstdc++-v3/testsuite/20_util/pair/moveable.cc
+++ b/libstdc++-v3/testsuite/20_util/pair/moveable.cc
@@ -1,4 +1,3 @@
-// { dg-require-rvalref "" }
// { dg-options "-std=gnu++0x" }
// Copyright (C) 2005, 2007 Free Software Foundation, Inc.