moveable.cc: Remove dg-require-rvalref.

2007-10-05  Paolo Carlini  <pcarlini@suse.de>

	* testsuite/23_containers/map/moveable.cc: Remove dg-require-rvalref.
	* testsuite/23_containers/multimap/moveable.cc: Likewise.
	* testsuite/23_containers/set/moveable.cc: Likewise. 
	* testsuite/23_containers/multiset/moveable.cc: Likewise.
	* testsuite/23_containers/deque/moveable.cc: Likewise. 
	* testsuite/23_containers/list/moveable.cc: Likewise. 
	* testsuite/23_containers/vector/moveable.cc: Likewise. 
	* include/std/utility: Use _GLIBCXX_BEGIN_NAMESPACE.

2007-10-05  Paolo Carlini  <pcarlini@suse.de>
	    Chris Jefferson  <chris@bubblescope.net>

	* include/bits/stl_iterator.h (class move_iterator,
	make_move_iterator): Add.

Co-Authored-By: Chris Jefferson <chris@bubblescope.net>

From-SVN: r129048
This commit is contained in:
Paolo Carlini 2007-10-06 02:33:12 +00:00 committed by Paolo Carlini
parent 02c9a7a7fc
commit f63bc637f6
10 changed files with 191 additions and 10 deletions

View File

@ -1,3 +1,20 @@
2007-10-05 Paolo Carlini <pcarlini@suse.de>
* testsuite/23_containers/map/moveable.cc: Remove dg-require-rvalref.
* testsuite/23_containers/multimap/moveable.cc: Likewise.
* testsuite/23_containers/set/moveable.cc: Likewise.
* testsuite/23_containers/multiset/moveable.cc: Likewise.
* testsuite/23_containers/deque/moveable.cc: Likewise.
* testsuite/23_containers/list/moveable.cc: Likewise.
* testsuite/23_containers/vector/moveable.cc: Likewise.
* include/std/utility: Use _GLIBCXX_BEGIN_NAMESPACE.
2007-10-05 Paolo Carlini <pcarlini@suse.de>
Chris Jefferson <chris@bubblescope.net>
* include/bits/stl_iterator.h (class move_iterator,
make_move_iterator): Add.
2007-10-04 Doug Kwan <dougkwan@google.com>
* include/ext/concurrent.h (class __mutex,

View File

@ -826,4 +826,173 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
_GLIBCXX_END_NAMESPACE
#ifdef __GXX_EXPERIMENTAL_CXX0X__
_GLIBCXX_BEGIN_NAMESPACE(std)
// 24.4.3 Move iterators
/**
* @if maint
* Class template move_iterator is an iterator adapter with the same
* behavior as the underlying iterator except that its dereference
* operator implicitly converts the value returned by the underlying
* iterator's dereference operator to an rvalue reference. Some
* generic algorithms can be called with move iterators to replace
* copying with moving.
* @endif
*/
template<typename _Iterator>
class move_iterator
{
protected:
_Iterator _M_current;
public:
typedef _Iterator iterator_type;
typedef typename iterator_traits<_Iterator>::difference_type
difference_type;
typedef typename iterator_traits<_Iterator>::pointer pointer;
typedef typename iterator_traits<_Iterator>::value_type value_type;
typedef typename iterator_traits<_Iterator>::iterator_category
iterator_category;
typedef value_type&& reference;
public:
move_iterator()
: _M_current() { }
explicit
move_iterator(iterator_type __i)
: _M_current(__i) { }
template<typename _Iter>
move_iterator(const move_iterator<_Iter>& __i)
: _M_current(__i.base()) { }
iterator_type
base() const
{ return _M_current; }
reference
operator*() const
{ return *_M_current; }
pointer
operator->() const
{ return _M_current; }
move_iterator&
operator++()
{
++_M_current;
return *this;
}
move_iterator
operator++(int)
{
move_iterator __tmp = *this;
++_M_current;
return __tmp;
}
move_iterator&
operator--()
{
--_M_current;
return *this;
}
move_iterator
operator--(int)
{
move_iterator __tmp = *this;
--_M_current;
return __tmp;
}
move_iterator
operator+(difference_type __n) const
{ return move_iterator(_M_current + __n); }
move_iterator&
operator+=(difference_type __n)
{
_M_current += __n;
return *this;
}
move_iterator
operator-(difference_type __n) const
{ return move_iterator(_M_current - __n); }
move_iterator&
operator-=(difference_type __n)
{
_M_current -= __n;
return *this;
}
reference
operator[](difference_type __n) const
{ return _M_current[__n]; }
};
template<typename _IteratorL, typename _IteratorR>
inline bool
operator==(const move_iterator<_IteratorL>& __x,
const move_iterator<_IteratorR>& __y)
{ return __x.base() == __y.base(); }
template<typename _IteratorL, typename _IteratorR>
inline bool
operator!=(const move_iterator<_IteratorL>& __x,
const move_iterator<_IteratorR>& __y)
{ return !(__x == __y); }
template<typename _IteratorL, typename _IteratorR>
inline bool
operator<(const move_iterator<_IteratorL>& __x,
const move_iterator<_IteratorR>& __y)
{ return __x.base() < __y.base(); }
template<typename _IteratorL, typename _IteratorR>
inline bool
operator<=(const move_iterator<_IteratorL>& __x,
const move_iterator<_IteratorR>& __y)
{ return !(__y < __x); }
template<typename _IteratorL, typename _IteratorR>
inline bool
operator>(const move_iterator<_IteratorL>& __x,
const move_iterator<_IteratorR>& __y)
{ return __y < __x; }
template<typename _IteratorL, typename _IteratorR>
inline bool
operator>=(const move_iterator<_IteratorL>& __x,
const move_iterator<_IteratorR>& __y)
{ return !(__x < __y); }
template<typename _IteratorL, typename _IteratorR>
inline typename move_iterator<_IteratorL>::difference_type
operator-(const move_iterator<_IteratorL>& __x,
const move_iterator<_IteratorR>& __y)
{ return __x.base() - __y.base(); }
template<typename _Iterator>
inline move_iterator<_Iterator>
operator+(typename move_iterator<_Iterator>::difference_type __n,
const move_iterator<_Iterator>& __x)
{ return __x + __n; }
template<typename _Iterator>
inline move_iterator<_Iterator>
make_move_iterator(const _Iterator& __i)
{ return move_iterator<_Iterator>(__i); }
_GLIBCXX_END_NAMESPACE
#endif // __GXX_EXPERIMENTAL_CXX0X__
#endif

View File

@ -87,8 +87,8 @@
#include <type_traits>
namespace std
{
_GLIBCXX_BEGIN_NAMESPACE(std)
// 20.2.2, forward/move
template<typename _Tp>
struct identity
@ -105,7 +105,8 @@ namespace std
inline typename std::remove_reference<_Tp>::type&&
move(_Tp&& __t)
{ return __t; }
}
_GLIBCXX_END_NAMESPACE
#endif

View File

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

View File

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

View File

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

View File

@ -1,4 +1,3 @@
// { dg-require-rvalref "" }
// { dg-options "-std=gnu++0x" }
// Copyright (C) 2005, 2007 Free Software Foundation, Inc.
@ -33,6 +32,7 @@
// this test may begin to fail.
#include <map>
#include <utility>
#include <testsuite_hooks.h>
int main()

View File

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

View File

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

View File

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