[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
This commit is contained in:
Paolo Carlini 2007-10-08 11:16:51 +00:00
parent f019adc116
commit 6c5f0578d9
7 changed files with 37 additions and 26 deletions

View File

@ -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>

View File

@ -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 \

View File

@ -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 \

View File

@ -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

View File

@ -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.

View File

@ -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 */

View File

@ -1,4 +1,3 @@
// { dg-require-rvalref "" }
// { dg-options "-std=gnu++0x" }
// Copyright (C) 2005, 2007 Free Software Foundation, Inc.