This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[v3] Adjust debug-mode containers for recent C++0x changes
- From: Paolo Carlini <pcarlini at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sun, 07 Oct 2007 18:35:24 +0200
- Subject: [v3] Adjust debug-mode containers for recent C++0x changes
Hi,
tested x86_64-linux, committed to mainline.
Paolo.
//////////////////
2007-10-07 Chris Jefferson <chris@bubblescope.net>
Paolo Carlini <pcarlini@suse.de>
* include/debug/list (list<>::list(list&&),
list<>::operator=(list&&)): Add.
(list<>::swap): Adjust.
(swap(list&&, list& __y), swap(list&, list&& __y)): Add.
* include/debug/vector (vector<>::vector(vector&&),
vector<>::operator=(vector&&)): Add.
(vector<>::swap): Adjust.
(swap(vector&&, vector& __y), swap(vector&, vector&& __y)): Add.
* include/debug/deque (deque<>::deque(deque&&),
deque<>::operator=(deque&&)): Add.
(deque<>::swap): Adjust.
(swap(deque&&, deque& __y), swap(deque&, deque&& __y)): Add.
* include/debug/set.h (set<>::set(set&&),
set<>::operator=(set&&)): Add.
(set<>::swap): Adjust.
(swap(set&&, set& __y), swap(set&, set&& __y)): Add.
* include/debug/map.h (map<>::map(map&&),
map<>::operator=(map&&)): Add.
(map<>::swap): Adjust.
(swap(map&&, map& __y), swap(map&, map&& __y)): Add.
* include/debug/multiset.h (multiset<>::multiset(multiset&&),
multiset<>::operator=(multiset&&)): Add.
(smultiet<>::swap): Adjust.
(swap(multiset&&, multiset& __y),
swap(multiset&, multiset&& __y)): Add.
* include/debug/multimap.h (multimap<>::multimap(multimap&&),
multimap<>::operator=(multimap&&)): Add.
(multimap<>::swap): Adjust.
(swap(multimap&&, multimap& __y),
swap(multimap&, multimap&& __y)): Add.
Index: include/debug/set.h
===================================================================
--- include/debug/set.h (revision 129067)
+++ include/debug/set.h (working copy)
@@ -1,6 +1,6 @@
// Debugging set implementation -*- C++ -*-
-// Copyright (C) 2003, 2004, 2005
+// Copyright (C) 2003, 2004, 2005, 2006, 2007
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -49,7 +49,7 @@
: public _GLIBCXX_STD_D::set<_Key,_Compare,_Allocator>,
public __gnu_debug::_Safe_sequence<set<_Key, _Compare, _Allocator> >
{
- typedef _GLIBCXX_STD_D::set<_Key,_Compare,_Allocator> _Base;
+ typedef _GLIBCXX_STD_D::set<_Key, _Compare, _Allocator> _Base;
typedef __gnu_debug::_Safe_sequence<set> _Safe_base;
public:
@@ -86,21 +86,37 @@
: _Base(__gnu_debug::__check_valid_range(__first, __last), __last,
__comp, __a) { }
- set(const set<_Key,_Compare,_Allocator>& __x)
+ set(const set& __x)
: _Base(__x), _Safe_base() { }
- set(const _Base& __x) : _Base(__x), _Safe_base() { }
+ set(const _Base& __x)
+ : _Base(__x), _Safe_base() { }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ set(set&& __x)
+ : _Base(__x), _Safe_base()
+ { this->_M_swap(__x); }
+#endif
~set() { }
- set<_Key,_Compare,_Allocator>&
- operator=(const set<_Key,_Compare,_Allocator>& __x)
+ set&
+ operator=(const set& __x)
{
*static_cast<_Base*>(this) = __x;
this->_M_invalidate_all();
return *this;
}
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ set&
+ operator=(set&& __x)
+ {
+ swap(__x);
+ return *this;
+ }
+#endif
+
using _Base::get_allocator;
// iterators:
@@ -200,7 +216,11 @@
}
void
- swap(set<_Key,_Compare,_Allocator>& __x)
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ swap(set&& __x)
+#else
+ swap(set& __x)
+#endif
{
_Base::swap(__x);
this->_M_swap(__x);
@@ -287,45 +307,60 @@
template<typename _Key, typename _Compare, typename _Allocator>
inline bool
- operator==(const set<_Key,_Compare,_Allocator>& __lhs,
- const set<_Key,_Compare,_Allocator>& __rhs)
+ operator==(const set<_Key, _Compare, _Allocator>& __lhs,
+ const set<_Key, _Compare, _Allocator>& __rhs)
{ return __lhs._M_base() == __rhs._M_base(); }
template<typename _Key, typename _Compare, typename _Allocator>
inline bool
- operator!=(const set<_Key,_Compare,_Allocator>& __lhs,
- const set<_Key,_Compare,_Allocator>& __rhs)
+ operator!=(const set<_Key, _Compare, _Allocator>& __lhs,
+ const set<_Key, _Compare, _Allocator>& __rhs)
{ return __lhs._M_base() != __rhs._M_base(); }
template<typename _Key, typename _Compare, typename _Allocator>
inline bool
- operator<(const set<_Key,_Compare,_Allocator>& __lhs,
- const set<_Key,_Compare,_Allocator>& __rhs)
+ operator<(const set<_Key, _Compare, _Allocator>& __lhs,
+ const set<_Key, _Compare, _Allocator>& __rhs)
{ return __lhs._M_base() < __rhs._M_base(); }
template<typename _Key, typename _Compare, typename _Allocator>
inline bool
- operator<=(const set<_Key,_Compare,_Allocator>& __lhs,
- const set<_Key,_Compare,_Allocator>& __rhs)
+ operator<=(const set<_Key, _Compare, _Allocator>& __lhs,
+ const set<_Key, _Compare, _Allocator>& __rhs)
{ return __lhs._M_base() <= __rhs._M_base(); }
template<typename _Key, typename _Compare, typename _Allocator>
inline bool
- operator>=(const set<_Key,_Compare,_Allocator>& __lhs,
- const set<_Key,_Compare,_Allocator>& __rhs)
+ operator>=(const set<_Key, _Compare, _Allocator>& __lhs,
+ const set<_Key, _Compare, _Allocator>& __rhs)
{ return __lhs._M_base() >= __rhs._M_base(); }
template<typename _Key, typename _Compare, typename _Allocator>
inline bool
- operator>(const set<_Key,_Compare,_Allocator>& __lhs,
- const set<_Key,_Compare,_Allocator>& __rhs)
+ operator>(const set<_Key, _Compare, _Allocator>& __lhs,
+ const set<_Key, _Compare, _Allocator>& __rhs)
{ return __lhs._M_base() > __rhs._M_base(); }
template<typename _Key, typename _Compare, typename _Allocator>
void
- swap(set<_Key,_Compare,_Allocator>& __x,
- set<_Key,_Compare,_Allocator>& __y)
+ swap(set<_Key, _Compare, _Allocator>& __x,
+ set<_Key, _Compare, _Allocator>& __y)
{ return __x.swap(__y); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Key, typename _Compare, typename _Allocator>
+ void
+ swap(set<_Key, _Compare, _Allocator>&& __x,
+ set<_Key, _Compare, _Allocator>& __y)
+ { return __x.swap(__y); }
+
+ template<typename _Key, typename _Compare, typename _Allocator>
+ void
+ swap(set<_Key, _Compare, _Allocator>& __x,
+ set<_Key, _Compare, _Allocator>&& __y)
+ { return __x.swap(__y); }
+#endif
+
} // namespace __debug
} // namespace std
Index: include/debug/multiset.h
===================================================================
--- include/debug/multiset.h (revision 129067)
+++ include/debug/multiset.h (working copy)
@@ -1,6 +1,6 @@
// Debugging multiset implementation -*- C++ -*-
-// Copyright (C) 2003, 2004, 2005
+// Copyright (C) 2003, 2004, 2005, 2006, 2007
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -86,21 +86,37 @@
: _Base(__gnu_debug::__check_valid_range(__first, __last), __last,
__comp, __a) { }
- multiset(const multiset<_Key,_Compare,_Allocator>& __x)
+ multiset(const multiset& __x)
: _Base(__x), _Safe_base() { }
- multiset(const _Base& __x) : _Base(__x), _Safe_base() { }
+ multiset(const _Base& __x)
+ : _Base(__x), _Safe_base() { }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ multiset(multiset&& __x)
+ : _Base(__x), _Safe_base()
+ { this->_M_swap(__x); }
+#endif
~multiset() { }
- multiset<_Key,_Compare,_Allocator>&
- operator=(const multiset<_Key,_Compare,_Allocator>& __x)
+ multiset&
+ operator=(const multiset& __x)
{
*static_cast<_Base*>(this) = __x;
this->_M_invalidate_all();
return *this;
}
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ multiset&
+ operator=(multiset&& __x)
+ {
+ swap(__x);
+ return *this;
+ }
+#endif
+
using _Base::get_allocator;
// iterators:
@@ -195,7 +211,11 @@
}
void
- swap(multiset<_Key,_Compare,_Allocator>& __x)
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ swap(multiset&& __x)
+#else
+ swap(multiset& __x)
+#endif
{
_Base::swap(__x);
this->_M_swap(__x);
@@ -282,45 +302,60 @@
template<typename _Key, typename _Compare, typename _Allocator>
inline bool
- operator==(const multiset<_Key,_Compare,_Allocator>& __lhs,
- const multiset<_Key,_Compare,_Allocator>& __rhs)
+ operator==(const multiset<_Key, _Compare, _Allocator>& __lhs,
+ const multiset<_Key, _Compare, _Allocator>& __rhs)
{ return __lhs._M_base() == __rhs._M_base(); }
template<typename _Key, typename _Compare, typename _Allocator>
inline bool
- operator!=(const multiset<_Key,_Compare,_Allocator>& __lhs,
- const multiset<_Key,_Compare,_Allocator>& __rhs)
+ operator!=(const multiset<_Key, _Compare, _Allocator>& __lhs,
+ const multiset<_Key, _Compare, _Allocator>& __rhs)
{ return __lhs._M_base() != __rhs._M_base(); }
template<typename _Key, typename _Compare, typename _Allocator>
inline bool
- operator<(const multiset<_Key,_Compare,_Allocator>& __lhs,
- const multiset<_Key,_Compare,_Allocator>& __rhs)
+ operator<(const multiset<_Key, _Compare, _Allocator>& __lhs,
+ const multiset<_Key, _Compare, _Allocator>& __rhs)
{ return __lhs._M_base() < __rhs._M_base(); }
template<typename _Key, typename _Compare, typename _Allocator>
inline bool
- operator<=(const multiset<_Key,_Compare,_Allocator>& __lhs,
- const multiset<_Key,_Compare,_Allocator>& __rhs)
+ operator<=(const multiset<_Key, _Compare, _Allocator>& __lhs,
+ const multiset<_Key, _Compare, _Allocator>& __rhs)
{ return __lhs._M_base() <= __rhs._M_base(); }
template<typename _Key, typename _Compare, typename _Allocator>
inline bool
- operator>=(const multiset<_Key,_Compare,_Allocator>& __lhs,
- const multiset<_Key,_Compare,_Allocator>& __rhs)
+ operator>=(const multiset<_Key, _Compare, _Allocator>& __lhs,
+ const multiset<_Key, _Compare, _Allocator>& __rhs)
{ return __lhs._M_base() >= __rhs._M_base(); }
template<typename _Key, typename _Compare, typename _Allocator>
inline bool
- operator>(const multiset<_Key,_Compare,_Allocator>& __lhs,
- const multiset<_Key,_Compare,_Allocator>& __rhs)
+ operator>(const multiset<_Key, _Compare, _Allocator>& __lhs,
+ const multiset<_Key, _Compare, _Allocator>& __rhs)
{ return __lhs._M_base() > __rhs._M_base(); }
template<typename _Key, typename _Compare, typename _Allocator>
void
- swap(multiset<_Key,_Compare,_Allocator>& __x,
- multiset<_Key,_Compare,_Allocator>& __y)
+ swap(multiset<_Key, _Compare, _Allocator>& __x,
+ multiset<_Key, _Compare, _Allocator>& __y)
{ return __x.swap(__y); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Key, typename _Compare, typename _Allocator>
+ void
+ swap(multiset<_Key, _Compare, _Allocator>&& __x,
+ multiset<_Key, _Compare, _Allocator>& __y)
+ { return __x.swap(__y); }
+
+ template<typename _Key, typename _Compare, typename _Allocator>
+ void
+ swap(multiset<_Key, _Compare, _Allocator>& __x,
+ multiset<_Key, _Compare, _Allocator>&& __y)
+ { return __x.swap(__y); }
+#endif
+
} // namespace __debug
} // namespace std
Index: include/debug/vector
===================================================================
--- include/debug/vector (revision 129067)
+++ include/debug/vector (working copy)
@@ -1,6 +1,6 @@
// Debugging vector implementation -*- C++ -*-
-// Copyright (C) 2003, 2004, 2005
+// Copyright (C) 2003, 2004, 2005, 2006, 2007
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -91,17 +91,26 @@
_M_guaranteed_capacity(0)
{ _M_update_guaranteed_capacity(); }
- vector(const vector<_Tp,_Allocator>& __x)
+ vector(const vector& __x)
: _Base(__x), _Safe_base(), _M_guaranteed_capacity(__x.size()) { }
/// Construction from a release-mode vector
vector(const _Base& __x)
: _Base(__x), _Safe_base(), _M_guaranteed_capacity(__x.size()) { }
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ vector(vector&& __x)
+ : _Base(__x), _Safe_base(), _M_guaranteed_capacity(this->size())
+ {
+ this->_M_swap(__x);
+ __x._M_guaranteed_capacity = 0;
+ }
+#endif
+
~vector() { }
- vector<_Tp,_Allocator>&
- operator=(const vector<_Tp,_Allocator>& __x)
+ vector&
+ operator=(const vector& __x)
{
static_cast<_Base&>(*this) = __x;
this->_M_invalidate_all();
@@ -109,6 +118,15 @@
return *this;
}
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ vector&
+ operator=(vector&& __x)
+ {
+ swap(__x);
+ return *this;
+ }
+#endif
+
template<typename _InputIterator>
void
assign(_InputIterator __first, _InputIterator __last)
@@ -335,7 +353,11 @@
}
void
- swap(vector<_Tp,_Allocator>& __x)
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ swap(vector&& __x)
+#else
+ swap(vector& __x)
+#endif
{
_Base::swap(__x);
this->_M_swap(__x);
@@ -417,6 +439,19 @@
inline void
swap(vector<_Tp, _Alloc>& __lhs, vector<_Tp, _Alloc>& __rhs)
{ __lhs.swap(__rhs); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Tp, typename _Alloc>
+ inline void
+ swap(vector<_Tp, _Alloc>&& __lhs, vector<_Tp, _Alloc>& __rhs)
+ { __lhs.swap(__rhs); }
+
+ template<typename _Tp, typename _Alloc>
+ inline void
+ swap(vector<_Tp, _Alloc>& __lhs, vector<_Tp, _Alloc>&& __rhs)
+ { __lhs.swap(__rhs); }
+#endif
+
} // namespace __debug
} // namespace std
Index: include/debug/map.h
===================================================================
--- include/debug/map.h (revision 129067)
+++ include/debug/map.h (working copy)
@@ -1,6 +1,6 @@
// Debugging map implementation -*- C++ -*-
-// Copyright (C) 2003, 2004, 2005
+// Copyright (C) 2003, 2004, 2005, 2006, 2007
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -88,21 +88,37 @@
: _Base(__gnu_debug::__check_valid_range(__first, __last), __last,
__comp, __a), _Safe_base() { }
- map(const map<_Key,_Tp,_Compare,_Allocator>& __x)
+ map(const map& __x)
: _Base(__x), _Safe_base() { }
- map(const _Base& __x) : _Base(__x), _Safe_base() { }
+ map(const _Base& __x)
+ : _Base(__x), _Safe_base() { }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ map(map&& __x)
+ : _Base(__x), _Safe_base()
+ { this->_M_swap(__x); }
+#endif
~map() { }
- map<_Key,_Tp,_Compare,_Allocator>&
- operator=(const map<_Key,_Tp,_Compare,_Allocator>& __x)
+ map&
+ operator=(const map& __x)
{
*static_cast<_Base*>(this) = __x;
this->_M_invalidate_all();
return *this;
}
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ map&
+ operator=(map&& __x)
+ {
+ swap(__x);
+ return *this;
+ }
+#endif
+
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 133. map missing get_allocator()
using _Base::get_allocator;
@@ -210,7 +226,11 @@
}
void
- swap(map<_Key,_Tp,_Compare,_Allocator>& __x)
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ swap(map&& __x)
+#else
+ swap(map& __x)
+#endif
{
_Base::swap(__x);
this->_M_swap(__x);
@@ -287,47 +307,71 @@
}
};
- template<typename _Key,typename _Tp,typename _Compare,typename _Allocator>
+ template<typename _Key, typename _Tp,
+ typename _Compare, typename _Allocator>
inline bool
- operator==(const map<_Key,_Tp,_Compare,_Allocator>& __lhs,
- const map<_Key,_Tp,_Compare,_Allocator>& __rhs)
+ operator==(const map<_Key, _Tp, _Compare, _Allocator>& __lhs,
+ const map<_Key, _Tp, _Compare, _Allocator>& __rhs)
{ return __lhs._M_base() == __rhs._M_base(); }
- template<typename _Key,typename _Tp,typename _Compare,typename _Allocator>
+ template<typename _Key, typename _Tp,
+ typename _Compare, typename _Allocator>
inline bool
- operator!=(const map<_Key,_Tp,_Compare,_Allocator>& __lhs,
- const map<_Key,_Tp,_Compare,_Allocator>& __rhs)
+ operator!=(const map<_Key, _Tp, _Compare, _Allocator>& __lhs,
+ const map<_Key, _Tp, _Compare, _Allocator>& __rhs)
{ return __lhs._M_base() != __rhs._M_base(); }
- template<typename _Key,typename _Tp,typename _Compare,typename _Allocator>
+ template<typename _Key, typename _Tp,
+ typename _Compare, typename _Allocator>
inline bool
- operator<(const map<_Key,_Tp,_Compare,_Allocator>& __lhs,
- const map<_Key,_Tp,_Compare,_Allocator>& __rhs)
+ operator<(const map<_Key, _Tp, _Compare, _Allocator>& __lhs,
+ const map<_Key, _Tp, _Compare, _Allocator>& __rhs)
{ return __lhs._M_base() < __rhs._M_base(); }
- template<typename _Key,typename _Tp,typename _Compare,typename _Allocator>
+ template<typename _Key, typename _Tp,
+ typename _Compare, typename _Allocator>
inline bool
- operator<=(const map<_Key,_Tp,_Compare,_Allocator>& __lhs,
- const map<_Key,_Tp,_Compare,_Allocator>& __rhs)
+ operator<=(const map<_Key, _Tp, _Compare, _Allocator>& __lhs,
+ const map<_Key, _Tp, _Compare, _Allocator>& __rhs)
{ return __lhs._M_base() <= __rhs._M_base(); }
- template<typename _Key,typename _Tp,typename _Compare,typename _Allocator>
+ template<typename _Key, typename _Tp,
+ typename _Compare, typename _Allocator>
inline bool
- operator>=(const map<_Key,_Tp,_Compare,_Allocator>& __lhs,
- const map<_Key,_Tp,_Compare,_Allocator>& __rhs)
+ operator>=(const map<_Key, _Tp, _Compare, _Allocator>& __lhs,
+ const map<_Key, _Tp, _Compare, _Allocator>& __rhs)
{ return __lhs._M_base() >= __rhs._M_base(); }
- template<typename _Key,typename _Tp,typename _Compare,typename _Allocator>
+ template<typename _Key, typename _Tp,
+ typename _Compare, typename _Allocator>
inline bool
- operator>(const map<_Key,_Tp,_Compare,_Allocator>& __lhs,
- const map<_Key,_Tp,_Compare,_Allocator>& __rhs)
+ operator>(const map<_Key, _Tp, _Compare, _Allocator>& __lhs,
+ const map<_Key, _Tp, _Compare, _Allocator>& __rhs)
{ return __lhs._M_base() > __rhs._M_base(); }
- template<typename _Key,typename _Tp,typename _Compare,typename _Allocator>
+ template<typename _Key, typename _Tp,
+ typename _Compare, typename _Allocator>
inline void
- swap(map<_Key,_Tp,_Compare,_Allocator>& __lhs,
- map<_Key,_Tp,_Compare,_Allocator>& __rhs)
+ swap(map<_Key, _Tp, _Compare, _Allocator>& __lhs,
+ map<_Key, _Tp, _Compare, _Allocator>& __rhs)
{ __lhs.swap(__rhs); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Key, typename _Tp,
+ typename _Compare, typename _Allocator>
+ inline void
+ swap(map<_Key, _Tp, _Compare, _Allocator>&& __lhs,
+ map<_Key, _Tp, _Compare, _Allocator>& __rhs)
+ { __lhs.swap(__rhs); }
+
+ template<typename _Key, typename _Tp,
+ typename _Compare, typename _Allocator>
+ inline void
+ swap(map<_Key, _Tp, _Compare, _Allocator>& __lhs,
+ map<_Key, _Tp, _Compare, _Allocator>&& __rhs)
+ { __lhs.swap(__rhs); }
+#endif
+
} // namespace __debug
} // namespace std
Index: include/debug/deque
===================================================================
--- include/debug/deque (revision 129067)
+++ include/debug/deque (working copy)
@@ -1,6 +1,6 @@
// Debugging deque implementation -*- C++ -*-
-// Copyright (C) 2003, 2004, 2005
+// Copyright (C) 2003, 2004, 2005, 2006, 2007
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -84,20 +84,37 @@
: _Base(__gnu_debug::__check_valid_range(__first, __last), __last, __a)
{ }
- deque(const deque<_Tp,_Allocator>& __x) : _Base(__x), _Safe_base() { }
+ deque(const deque& __x)
+ : _Base(__x), _Safe_base() { }
- deque(const _Base& __x) : _Base(__x), _Safe_base() { }
+ deque(const _Base& __x)
+ : _Base(__x), _Safe_base() { }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ deque(deque&& __x)
+ : _Base(__x), _Safe_base()
+ { this->_M_swap(__x); }
+#endif
~deque() { }
- deque<_Tp,_Allocator>&
- operator=(const deque<_Tp,_Allocator>& __x)
+ deque&
+ operator=(const deque& __x)
{
*static_cast<_Base*>(this) = __x;
this->_M_invalidate_all();
return *this;
}
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ deque&
+ operator=(deque&& __x)
+ {
+ swap(__x);
+ return *this;
+ }
+#endif
+
template<class _InputIterator>
void
assign(_InputIterator __first, _InputIterator __last)
@@ -329,7 +346,11 @@
}
void
- swap(deque<_Tp,_Allocator>& __x)
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ swap(deque&& __x)
+#else
+ swap(deque& __x)
+#endif
{
_Base::swap(__x);
this->_M_swap(__x);
@@ -363,7 +384,8 @@
template<typename _Tp, typename _Alloc>
inline bool
- operator<(const deque<_Tp, _Alloc>& __lhs, const deque<_Tp, _Alloc>& __rhs)
+ operator<(const deque<_Tp, _Alloc>& __lhs,
+ const deque<_Tp, _Alloc>& __rhs)
{ return __lhs._M_base() < __rhs._M_base(); }
template<typename _Tp, typename _Alloc>
@@ -380,13 +402,27 @@
template<typename _Tp, typename _Alloc>
inline bool
- operator>(const deque<_Tp, _Alloc>& __lhs, const deque<_Tp, _Alloc>& __rhs)
+ operator>(const deque<_Tp, _Alloc>& __lhs,
+ const deque<_Tp, _Alloc>& __rhs)
{ return __lhs._M_base() > __rhs._M_base(); }
template<typename _Tp, typename _Alloc>
inline void
swap(deque<_Tp, _Alloc>& __lhs, deque<_Tp, _Alloc>& __rhs)
{ __lhs.swap(__rhs); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Tp, typename _Alloc>
+ inline void
+ swap(deque<_Tp, _Alloc>&& __lhs, deque<_Tp, _Alloc>& __rhs)
+ { __lhs.swap(__rhs); }
+
+ template<typename _Tp, typename _Alloc>
+ inline void
+ swap(deque<_Tp, _Alloc>& __lhs, deque<_Tp, _Alloc>&& __rhs)
+ { __lhs.swap(__rhs); }
+#endif
+
} // namespace __debug
} // namespace std
Index: include/debug/list
===================================================================
--- include/debug/list (revision 129067)
+++ include/debug/list (working copy)
@@ -1,6 +1,6 @@
// Debugging list implementation -*- C++ -*-
-// Copyright (C) 2003, 2004, 2005, 2006
+// Copyright (C) 2003, 2004, 2005, 2006, 2007
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -113,9 +113,17 @@
{ }
- list(const list& __x) : _Base(__x), _Safe_base() { }
+ list(const list& __x)
+ : _Base(__x), _Safe_base() { }
- list(const _Base& __x) : _Base(__x), _Safe_base() { }
+ list(const _Base& __x)
+ : _Base(__x), _Safe_base() { }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ list(list&& __x)
+ : _Base(__x), _Safe_base()
+ { this->_M_swap(__x); }
+#endif
~list() { }
@@ -127,6 +135,15 @@
return *this;
}
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ list&
+ operator=(list&& __x)
+ {
+ swap(__x);
+ return *this;
+ }
+#endif
+
template<class _InputIterator>
void
assign(_InputIterator __first, _InputIterator __last)
@@ -311,7 +328,11 @@
}
void
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ swap(list&& __x)
+#else
swap(list& __x)
+#endif
{
_Base::swap(__x);
this->_M_swap(__x);
@@ -502,38 +523,57 @@
template<typename _Tp, typename _Alloc>
inline bool
- operator==(const list<_Tp, _Alloc>& __lhs, const list<_Tp, _Alloc>& __rhs)
+ operator==(const list<_Tp, _Alloc>& __lhs,
+ const list<_Tp, _Alloc>& __rhs)
{ return __lhs._M_base() == __rhs._M_base(); }
template<typename _Tp, typename _Alloc>
inline bool
- operator!=(const list<_Tp, _Alloc>& __lhs, const list<_Tp, _Alloc>& __rhs)
+ operator!=(const list<_Tp, _Alloc>& __lhs,
+ const list<_Tp, _Alloc>& __rhs)
{ return __lhs._M_base() != __rhs._M_base(); }
template<typename _Tp, typename _Alloc>
inline bool
- operator<(const list<_Tp, _Alloc>& __lhs, const list<_Tp, _Alloc>& __rhs)
+ operator<(const list<_Tp, _Alloc>& __lhs,
+ const list<_Tp, _Alloc>& __rhs)
{ return __lhs._M_base() < __rhs._M_base(); }
template<typename _Tp, typename _Alloc>
inline bool
- operator<=(const list<_Tp, _Alloc>& __lhs, const list<_Tp, _Alloc>& __rhs)
+ operator<=(const list<_Tp, _Alloc>& __lhs,
+ const list<_Tp, _Alloc>& __rhs)
{ return __lhs._M_base() <= __rhs._M_base(); }
template<typename _Tp, typename _Alloc>
inline bool
- operator>=(const list<_Tp, _Alloc>& __lhs, const list<_Tp, _Alloc>& __rhs)
+ operator>=(const list<_Tp, _Alloc>& __lhs,
+ const list<_Tp, _Alloc>& __rhs)
{ return __lhs._M_base() >= __rhs._M_base(); }
template<typename _Tp, typename _Alloc>
inline bool
- operator>(const list<_Tp, _Alloc>& __lhs, const list<_Tp, _Alloc>& __rhs)
+ operator>(const list<_Tp, _Alloc>& __lhs,
+ const list<_Tp, _Alloc>& __rhs)
{ return __lhs._M_base() > __rhs._M_base(); }
template<typename _Tp, typename _Alloc>
inline void
swap(list<_Tp, _Alloc>& __lhs, list<_Tp, _Alloc>& __rhs)
{ __lhs.swap(__rhs); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Tp, typename _Alloc>
+ inline void
+ swap(list<_Tp, _Alloc>&& __lhs, list<_Tp, _Alloc>& __rhs)
+ { __lhs.swap(__rhs); }
+
+ template<typename _Tp, typename _Alloc>
+ inline void
+ swap(list<_Tp, _Alloc>& __lhs, list<_Tp, _Alloc>&& __rhs)
+ { __lhs.swap(__rhs); }
+#endif
+
} // namespace __debug
} // namespace std
Index: include/debug/multimap.h
===================================================================
--- include/debug/multimap.h (revision 129067)
+++ include/debug/multimap.h (working copy)
@@ -1,6 +1,6 @@
// Debugging multimap implementation -*- C++ -*-
-// Copyright (C) 2003, 2004, 2005
+// Copyright (C) 2003, 2004, 2005, 2006, 2007
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -47,7 +47,8 @@
typename _Allocator = std::allocator<std::pair<const _Key, _Tp> > >
class multimap
: public _GLIBCXX_STD_D::multimap<_Key, _Tp, _Compare, _Allocator>,
- public __gnu_debug::_Safe_sequence<multimap<_Key,_Tp,_Compare,_Allocator> >
+ public __gnu_debug::_Safe_sequence<multimap<_Key, _Tp,
+ _Compare, _Allocator> >
{
typedef _GLIBCXX_STD_D::multimap<_Key, _Tp, _Compare, _Allocator> _Base;
typedef __gnu_debug::_Safe_sequence<multimap> _Safe_base;
@@ -88,21 +89,37 @@
: _Base(__gnu_debug::__check_valid_range(__first, __last), __last,
__comp, __a) { }
- multimap(const multimap<_Key,_Tp,_Compare,_Allocator>& __x)
+ multimap(const multimap& __x)
: _Base(__x), _Safe_base() { }
- multimap(const _Base& __x) : _Base(__x), _Safe_base() { }
+ multimap(const _Base& __x)
+ : _Base(__x), _Safe_base() { }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ multimap(multimap&& __x)
+ : _Base(__x), _Safe_base()
+ { this->_M_swap(__x); }
+#endif
~multimap() { }
- multimap<_Key,_Tp,_Compare,_Allocator>&
- operator=(const multimap<_Key,_Tp,_Compare,_Allocator>& __x)
+ multimap&
+ operator=(const multimap& __x)
{
*static_cast<_Base*>(this) = __x;
this->_M_invalidate_all();
return *this;
}
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ multimap&
+ operator=(multimap&& __x)
+ {
+ swap(__x);
+ return *this;
+ }
+#endif
+
using _Base::get_allocator;
// iterators:
@@ -197,7 +214,11 @@
}
void
- swap(multimap<_Key,_Tp,_Compare,_Allocator>& __x)
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ swap(multimap&& __x)
+#else
+ swap(multimap& __x)
+#endif
{
_Base::swap(__x);
this->_M_swap(__x);
@@ -274,47 +295,71 @@
}
};
- template<typename _Key,typename _Tp,typename _Compare,typename _Allocator>
+ template<typename _Key, typename _Tp,
+ typename _Compare, typename _Allocator>
inline bool
- operator==(const multimap<_Key,_Tp,_Compare,_Allocator>& __lhs,
- const multimap<_Key,_Tp,_Compare,_Allocator>& __rhs)
+ operator==(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
+ const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
{ return __lhs._M_base() == __rhs._M_base(); }
- template<typename _Key,typename _Tp,typename _Compare,typename _Allocator>
+ template<typename _Key, typename _Tp,
+ typename _Compare, typename _Allocator>
inline bool
- operator!=(const multimap<_Key,_Tp,_Compare,_Allocator>& __lhs,
- const multimap<_Key,_Tp,_Compare,_Allocator>& __rhs)
+ operator!=(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
+ const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
{ return __lhs._M_base() != __rhs._M_base(); }
- template<typename _Key,typename _Tp,typename _Compare,typename _Allocator>
+ template<typename _Key, typename _Tp,
+ typename _Compare, typename _Allocator>
inline bool
- operator<(const multimap<_Key,_Tp,_Compare,_Allocator>& __lhs,
- const multimap<_Key,_Tp,_Compare,_Allocator>& __rhs)
+ operator<(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
+ const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
{ return __lhs._M_base() < __rhs._M_base(); }
- template<typename _Key,typename _Tp,typename _Compare,typename _Allocator>
+ template<typename _Key, typename _Tp,
+ typename _Compare, typename _Allocator>
inline bool
- operator<=(const multimap<_Key,_Tp,_Compare,_Allocator>& __lhs,
- const multimap<_Key,_Tp,_Compare,_Allocator>& __rhs)
+ operator<=(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
+ const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
{ return __lhs._M_base() <= __rhs._M_base(); }
- template<typename _Key,typename _Tp,typename _Compare,typename _Allocator>
+ template<typename _Key, typename _Tp,
+ typename _Compare, typename _Allocator>
inline bool
- operator>=(const multimap<_Key,_Tp,_Compare,_Allocator>& __lhs,
- const multimap<_Key,_Tp,_Compare,_Allocator>& __rhs)
+ operator>=(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
+ const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
{ return __lhs._M_base() >= __rhs._M_base(); }
- template<typename _Key,typename _Tp,typename _Compare,typename _Allocator>
+ template<typename _Key, typename _Tp,
+ typename _Compare, typename _Allocator>
inline bool
- operator>(const multimap<_Key,_Tp,_Compare,_Allocator>& __lhs,
- const multimap<_Key,_Tp,_Compare,_Allocator>& __rhs)
+ operator>(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
+ const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
{ return __lhs._M_base() > __rhs._M_base(); }
- template<typename _Key,typename _Tp,typename _Compare,typename _Allocator>
+ template<typename _Key, typename _Tp,
+ typename _Compare, typename _Allocator>
inline void
- swap(multimap<_Key,_Tp,_Compare,_Allocator>& __lhs,
- multimap<_Key,_Tp,_Compare,_Allocator>& __rhs)
+ swap(multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
+ multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
{ __lhs.swap(__rhs); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Key, typename _Tp,
+ typename _Compare, typename _Allocator>
+ inline void
+ swap(multimap<_Key, _Tp, _Compare, _Allocator>&& __lhs,
+ multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
+ { __lhs.swap(__rhs); }
+
+ template<typename _Key, typename _Tp,
+ typename _Compare, typename _Allocator>
+ inline void
+ swap(multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
+ multimap<_Key, _Tp, _Compare, _Allocator>&& __rhs)
+ { __lhs.swap(__rhs); }
+#endif
+
} // namespace __debug
} // namespace std