Commit ed540c0a by Chris Jefferson Committed by Paolo Carlini

list (list<>::list(list&&), [...]): Add.

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.

Co-Authored-By: Paolo Carlini <pcarlini@suse.de>

From-SVN: r129071
parent becb103c
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.
2007-10-07 Paolo Carlini <pcarlini@suse.de> 2007-10-07 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_algobase.h (_GLIBCXX_MOVE): Add. * include/bits/stl_algobase.h (_GLIBCXX_MOVE): Add.
......
// Debugging deque implementation -*- C++ -*- // Debugging deque implementation -*- C++ -*-
// Copyright (C) 2003, 2004, 2005 // Copyright (C) 2003, 2004, 2005, 2006, 2007
// Free Software Foundation, Inc. // Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
...@@ -84,20 +84,37 @@ namespace __debug ...@@ -84,20 +84,37 @@ namespace __debug
: _Base(__gnu_debug::__check_valid_range(__first, __last), __last, __a) : _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() { }
deque<_Tp,_Allocator>& deque&
operator=(const deque<_Tp,_Allocator>& __x) operator=(const deque& __x)
{ {
*static_cast<_Base*>(this) = __x; *static_cast<_Base*>(this) = __x;
this->_M_invalidate_all(); this->_M_invalidate_all();
return *this; return *this;
} }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
deque&
operator=(deque&& __x)
{
swap(__x);
return *this;
}
#endif
template<class _InputIterator> template<class _InputIterator>
void void
assign(_InputIterator __first, _InputIterator __last) assign(_InputIterator __first, _InputIterator __last)
...@@ -329,7 +346,11 @@ namespace __debug ...@@ -329,7 +346,11 @@ namespace __debug
} }
void void
swap(deque<_Tp,_Allocator>& __x) #ifdef __GXX_EXPERIMENTAL_CXX0X__
swap(deque&& __x)
#else
swap(deque& __x)
#endif
{ {
_Base::swap(__x); _Base::swap(__x);
this->_M_swap(__x); this->_M_swap(__x);
...@@ -363,7 +384,8 @@ namespace __debug ...@@ -363,7 +384,8 @@ namespace __debug
template<typename _Tp, typename _Alloc> template<typename _Tp, typename _Alloc>
inline bool 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(); } { return __lhs._M_base() < __rhs._M_base(); }
template<typename _Tp, typename _Alloc> template<typename _Tp, typename _Alloc>
...@@ -380,13 +402,27 @@ namespace __debug ...@@ -380,13 +402,27 @@ namespace __debug
template<typename _Tp, typename _Alloc> template<typename _Tp, typename _Alloc>
inline bool 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(); } { return __lhs._M_base() > __rhs._M_base(); }
template<typename _Tp, typename _Alloc> template<typename _Tp, typename _Alloc>
inline void inline void
swap(deque<_Tp, _Alloc>& __lhs, deque<_Tp, _Alloc>& __rhs) swap(deque<_Tp, _Alloc>& __lhs, deque<_Tp, _Alloc>& __rhs)
{ __lhs.swap(__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 __debug
} // namespace std } // namespace std
......
// Debugging list implementation -*- C++ -*- // Debugging list implementation -*- C++ -*-
// Copyright (C) 2003, 2004, 2005, 2006 // Copyright (C) 2003, 2004, 2005, 2006, 2007
// Free Software Foundation, Inc. // Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
...@@ -113,9 +113,17 @@ namespace __debug ...@@ -113,9 +113,17 @@ namespace __debug
{ } { }
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() { } ~list() { }
...@@ -127,6 +135,15 @@ namespace __debug ...@@ -127,6 +135,15 @@ namespace __debug
return *this; return *this;
} }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
list&
operator=(list&& __x)
{
swap(__x);
return *this;
}
#endif
template<class _InputIterator> template<class _InputIterator>
void void
assign(_InputIterator __first, _InputIterator __last) assign(_InputIterator __first, _InputIterator __last)
...@@ -311,7 +328,11 @@ namespace __debug ...@@ -311,7 +328,11 @@ namespace __debug
} }
void void
#ifdef __GXX_EXPERIMENTAL_CXX0X__
swap(list&& __x)
#else
swap(list& __x) swap(list& __x)
#endif
{ {
_Base::swap(__x); _Base::swap(__x);
this->_M_swap(__x); this->_M_swap(__x);
...@@ -502,38 +523,57 @@ namespace __debug ...@@ -502,38 +523,57 @@ namespace __debug
template<typename _Tp, typename _Alloc> template<typename _Tp, typename _Alloc>
inline bool 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(); } { return __lhs._M_base() == __rhs._M_base(); }
template<typename _Tp, typename _Alloc> template<typename _Tp, typename _Alloc>
inline bool 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(); } { return __lhs._M_base() != __rhs._M_base(); }
template<typename _Tp, typename _Alloc> template<typename _Tp, typename _Alloc>
inline bool 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(); } { return __lhs._M_base() < __rhs._M_base(); }
template<typename _Tp, typename _Alloc> template<typename _Tp, typename _Alloc>
inline bool 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(); } { return __lhs._M_base() <= __rhs._M_base(); }
template<typename _Tp, typename _Alloc> template<typename _Tp, typename _Alloc>
inline bool 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(); } { return __lhs._M_base() >= __rhs._M_base(); }
template<typename _Tp, typename _Alloc> template<typename _Tp, typename _Alloc>
inline bool 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(); } { return __lhs._M_base() > __rhs._M_base(); }
template<typename _Tp, typename _Alloc> template<typename _Tp, typename _Alloc>
inline void inline void
swap(list<_Tp, _Alloc>& __lhs, list<_Tp, _Alloc>& __rhs) swap(list<_Tp, _Alloc>& __lhs, list<_Tp, _Alloc>& __rhs)
{ __lhs.swap(__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 __debug
} // namespace std } // namespace std
......
// Debugging map implementation -*- C++ -*- // Debugging map implementation -*- C++ -*-
// Copyright (C) 2003, 2004, 2005 // Copyright (C) 2003, 2004, 2005, 2006, 2007
// Free Software Foundation, Inc. // Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
...@@ -88,21 +88,37 @@ namespace __debug ...@@ -88,21 +88,37 @@ namespace __debug
: _Base(__gnu_debug::__check_valid_range(__first, __last), __last, : _Base(__gnu_debug::__check_valid_range(__first, __last), __last,
__comp, __a), _Safe_base() { } __comp, __a), _Safe_base() { }
map(const map<_Key,_Tp,_Compare,_Allocator>& __x) map(const map& __x)
: _Base(__x), _Safe_base() { } : _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() { }
map<_Key,_Tp,_Compare,_Allocator>& map&
operator=(const map<_Key,_Tp,_Compare,_Allocator>& __x) operator=(const map& __x)
{ {
*static_cast<_Base*>(this) = __x; *static_cast<_Base*>(this) = __x;
this->_M_invalidate_all(); this->_M_invalidate_all();
return *this; return *this;
} }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
map&
operator=(map&& __x)
{
swap(__x);
return *this;
}
#endif
// _GLIBCXX_RESOLVE_LIB_DEFECTS // _GLIBCXX_RESOLVE_LIB_DEFECTS
// 133. map missing get_allocator() // 133. map missing get_allocator()
using _Base::get_allocator; using _Base::get_allocator;
...@@ -210,7 +226,11 @@ namespace __debug ...@@ -210,7 +226,11 @@ namespace __debug
} }
void void
swap(map<_Key,_Tp,_Compare,_Allocator>& __x) #ifdef __GXX_EXPERIMENTAL_CXX0X__
swap(map&& __x)
#else
swap(map& __x)
#endif
{ {
_Base::swap(__x); _Base::swap(__x);
this->_M_swap(__x); this->_M_swap(__x);
...@@ -287,47 +307,71 @@ namespace __debug ...@@ -287,47 +307,71 @@ namespace __debug
} }
}; };
template<typename _Key,typename _Tp,typename _Compare,typename _Allocator> template<typename _Key, typename _Tp,
typename _Compare, typename _Allocator>
inline bool inline bool
operator==(const map<_Key,_Tp,_Compare,_Allocator>& __lhs, operator==(const map<_Key, _Tp, _Compare, _Allocator>& __lhs,
const map<_Key,_Tp,_Compare,_Allocator>& __rhs) const map<_Key, _Tp, _Compare, _Allocator>& __rhs)
{ return __lhs._M_base() == __rhs._M_base(); } { 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 inline bool
operator!=(const map<_Key,_Tp,_Compare,_Allocator>& __lhs, operator!=(const map<_Key, _Tp, _Compare, _Allocator>& __lhs,
const map<_Key,_Tp,_Compare,_Allocator>& __rhs) const map<_Key, _Tp, _Compare, _Allocator>& __rhs)
{ return __lhs._M_base() != __rhs._M_base(); } { 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 inline bool
operator<(const map<_Key,_Tp,_Compare,_Allocator>& __lhs, operator<(const map<_Key, _Tp, _Compare, _Allocator>& __lhs,
const map<_Key,_Tp,_Compare,_Allocator>& __rhs) const map<_Key, _Tp, _Compare, _Allocator>& __rhs)
{ return __lhs._M_base() < __rhs._M_base(); } { 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 inline bool
operator<=(const map<_Key,_Tp,_Compare,_Allocator>& __lhs, operator<=(const map<_Key, _Tp, _Compare, _Allocator>& __lhs,
const map<_Key,_Tp,_Compare,_Allocator>& __rhs) const map<_Key, _Tp, _Compare, _Allocator>& __rhs)
{ return __lhs._M_base() <= __rhs._M_base(); } { 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 inline bool
operator>=(const map<_Key,_Tp,_Compare,_Allocator>& __lhs, operator>=(const map<_Key, _Tp, _Compare, _Allocator>& __lhs,
const map<_Key,_Tp,_Compare,_Allocator>& __rhs) const map<_Key, _Tp, _Compare, _Allocator>& __rhs)
{ return __lhs._M_base() >= __rhs._M_base(); } { 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 inline bool
operator>(const map<_Key,_Tp,_Compare,_Allocator>& __lhs, operator>(const map<_Key, _Tp, _Compare, _Allocator>& __lhs,
const map<_Key,_Tp,_Compare,_Allocator>& __rhs) const map<_Key, _Tp, _Compare, _Allocator>& __rhs)
{ return __lhs._M_base() > __rhs._M_base(); } { 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 inline void
swap(map<_Key,_Tp,_Compare,_Allocator>& __lhs, swap(map<_Key, _Tp, _Compare, _Allocator>& __lhs,
map<_Key,_Tp,_Compare,_Allocator>& __rhs) map<_Key, _Tp, _Compare, _Allocator>& __rhs)
{ __lhs.swap(__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 __debug
} // namespace std } // namespace std
......
// Debugging multimap implementation -*- C++ -*- // Debugging multimap implementation -*- C++ -*-
// Copyright (C) 2003, 2004, 2005 // Copyright (C) 2003, 2004, 2005, 2006, 2007
// Free Software Foundation, Inc. // Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
...@@ -47,7 +47,8 @@ namespace __debug ...@@ -47,7 +47,8 @@ namespace __debug
typename _Allocator = std::allocator<std::pair<const _Key, _Tp> > > typename _Allocator = std::allocator<std::pair<const _Key, _Tp> > >
class multimap class multimap
: public _GLIBCXX_STD_D::multimap<_Key, _Tp, _Compare, _Allocator>, : 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 _GLIBCXX_STD_D::multimap<_Key, _Tp, _Compare, _Allocator> _Base;
typedef __gnu_debug::_Safe_sequence<multimap> _Safe_base; typedef __gnu_debug::_Safe_sequence<multimap> _Safe_base;
...@@ -88,21 +89,37 @@ namespace __debug ...@@ -88,21 +89,37 @@ namespace __debug
: _Base(__gnu_debug::__check_valid_range(__first, __last), __last, : _Base(__gnu_debug::__check_valid_range(__first, __last), __last,
__comp, __a) { } __comp, __a) { }
multimap(const multimap<_Key,_Tp,_Compare,_Allocator>& __x) multimap(const multimap& __x)
: _Base(__x), _Safe_base() { } : _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() { }
multimap<_Key,_Tp,_Compare,_Allocator>& multimap&
operator=(const multimap<_Key,_Tp,_Compare,_Allocator>& __x) operator=(const multimap& __x)
{ {
*static_cast<_Base*>(this) = __x; *static_cast<_Base*>(this) = __x;
this->_M_invalidate_all(); this->_M_invalidate_all();
return *this; return *this;
} }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
multimap&
operator=(multimap&& __x)
{
swap(__x);
return *this;
}
#endif
using _Base::get_allocator; using _Base::get_allocator;
// iterators: // iterators:
...@@ -197,7 +214,11 @@ namespace __debug ...@@ -197,7 +214,11 @@ namespace __debug
} }
void void
swap(multimap<_Key,_Tp,_Compare,_Allocator>& __x) #ifdef __GXX_EXPERIMENTAL_CXX0X__
swap(multimap&& __x)
#else
swap(multimap& __x)
#endif
{ {
_Base::swap(__x); _Base::swap(__x);
this->_M_swap(__x); this->_M_swap(__x);
...@@ -274,47 +295,71 @@ namespace __debug ...@@ -274,47 +295,71 @@ namespace __debug
} }
}; };
template<typename _Key,typename _Tp,typename _Compare,typename _Allocator> template<typename _Key, typename _Tp,
typename _Compare, typename _Allocator>
inline bool inline bool
operator==(const multimap<_Key,_Tp,_Compare,_Allocator>& __lhs, operator==(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
const multimap<_Key,_Tp,_Compare,_Allocator>& __rhs) const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
{ return __lhs._M_base() == __rhs._M_base(); } { 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 inline bool
operator!=(const multimap<_Key,_Tp,_Compare,_Allocator>& __lhs, operator!=(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
const multimap<_Key,_Tp,_Compare,_Allocator>& __rhs) const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
{ return __lhs._M_base() != __rhs._M_base(); } { 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 inline bool
operator<(const multimap<_Key,_Tp,_Compare,_Allocator>& __lhs, operator<(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
const multimap<_Key,_Tp,_Compare,_Allocator>& __rhs) const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
{ return __lhs._M_base() < __rhs._M_base(); } { 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 inline bool
operator<=(const multimap<_Key,_Tp,_Compare,_Allocator>& __lhs, operator<=(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
const multimap<_Key,_Tp,_Compare,_Allocator>& __rhs) const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
{ return __lhs._M_base() <= __rhs._M_base(); } { 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 inline bool
operator>=(const multimap<_Key,_Tp,_Compare,_Allocator>& __lhs, operator>=(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
const multimap<_Key,_Tp,_Compare,_Allocator>& __rhs) const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
{ return __lhs._M_base() >= __rhs._M_base(); } { 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 inline bool
operator>(const multimap<_Key,_Tp,_Compare,_Allocator>& __lhs, operator>(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
const multimap<_Key,_Tp,_Compare,_Allocator>& __rhs) const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
{ return __lhs._M_base() > __rhs._M_base(); } { 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 inline void
swap(multimap<_Key,_Tp,_Compare,_Allocator>& __lhs, swap(multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
multimap<_Key,_Tp,_Compare,_Allocator>& __rhs) multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
{ __lhs.swap(__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 __debug
} // namespace std } // namespace std
......
// Debugging multiset implementation -*- C++ -*- // Debugging multiset implementation -*- C++ -*-
// Copyright (C) 2003, 2004, 2005 // Copyright (C) 2003, 2004, 2005, 2006, 2007
// Free Software Foundation, Inc. // Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
...@@ -86,21 +86,37 @@ namespace __debug ...@@ -86,21 +86,37 @@ namespace __debug
: _Base(__gnu_debug::__check_valid_range(__first, __last), __last, : _Base(__gnu_debug::__check_valid_range(__first, __last), __last,
__comp, __a) { } __comp, __a) { }
multiset(const multiset<_Key,_Compare,_Allocator>& __x) multiset(const multiset& __x)
: _Base(__x), _Safe_base() { } : _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() { }
multiset<_Key,_Compare,_Allocator>& multiset&
operator=(const multiset<_Key,_Compare,_Allocator>& __x) operator=(const multiset& __x)
{ {
*static_cast<_Base*>(this) = __x; *static_cast<_Base*>(this) = __x;
this->_M_invalidate_all(); this->_M_invalidate_all();
return *this; return *this;
} }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
multiset&
operator=(multiset&& __x)
{
swap(__x);
return *this;
}
#endif
using _Base::get_allocator; using _Base::get_allocator;
// iterators: // iterators:
...@@ -195,7 +211,11 @@ namespace __debug ...@@ -195,7 +211,11 @@ namespace __debug
} }
void void
swap(multiset<_Key,_Compare,_Allocator>& __x) #ifdef __GXX_EXPERIMENTAL_CXX0X__
swap(multiset&& __x)
#else
swap(multiset& __x)
#endif
{ {
_Base::swap(__x); _Base::swap(__x);
this->_M_swap(__x); this->_M_swap(__x);
...@@ -282,45 +302,60 @@ namespace __debug ...@@ -282,45 +302,60 @@ namespace __debug
template<typename _Key, typename _Compare, typename _Allocator> template<typename _Key, typename _Compare, typename _Allocator>
inline bool inline bool
operator==(const multiset<_Key,_Compare,_Allocator>& __lhs, operator==(const multiset<_Key, _Compare, _Allocator>& __lhs,
const multiset<_Key,_Compare,_Allocator>& __rhs) const multiset<_Key, _Compare, _Allocator>& __rhs)
{ return __lhs._M_base() == __rhs._M_base(); } { return __lhs._M_base() == __rhs._M_base(); }
template<typename _Key, typename _Compare, typename _Allocator> template<typename _Key, typename _Compare, typename _Allocator>
inline bool inline bool
operator!=(const multiset<_Key,_Compare,_Allocator>& __lhs, operator!=(const multiset<_Key, _Compare, _Allocator>& __lhs,
const multiset<_Key,_Compare,_Allocator>& __rhs) const multiset<_Key, _Compare, _Allocator>& __rhs)
{ return __lhs._M_base() != __rhs._M_base(); } { return __lhs._M_base() != __rhs._M_base(); }
template<typename _Key, typename _Compare, typename _Allocator> template<typename _Key, typename _Compare, typename _Allocator>
inline bool inline bool
operator<(const multiset<_Key,_Compare,_Allocator>& __lhs, operator<(const multiset<_Key, _Compare, _Allocator>& __lhs,
const multiset<_Key,_Compare,_Allocator>& __rhs) const multiset<_Key, _Compare, _Allocator>& __rhs)
{ return __lhs._M_base() < __rhs._M_base(); } { return __lhs._M_base() < __rhs._M_base(); }
template<typename _Key, typename _Compare, typename _Allocator> template<typename _Key, typename _Compare, typename _Allocator>
inline bool inline bool
operator<=(const multiset<_Key,_Compare,_Allocator>& __lhs, operator<=(const multiset<_Key, _Compare, _Allocator>& __lhs,
const multiset<_Key,_Compare,_Allocator>& __rhs) const multiset<_Key, _Compare, _Allocator>& __rhs)
{ return __lhs._M_base() <= __rhs._M_base(); } { return __lhs._M_base() <= __rhs._M_base(); }
template<typename _Key, typename _Compare, typename _Allocator> template<typename _Key, typename _Compare, typename _Allocator>
inline bool inline bool
operator>=(const multiset<_Key,_Compare,_Allocator>& __lhs, operator>=(const multiset<_Key, _Compare, _Allocator>& __lhs,
const multiset<_Key,_Compare,_Allocator>& __rhs) const multiset<_Key, _Compare, _Allocator>& __rhs)
{ return __lhs._M_base() >= __rhs._M_base(); } { return __lhs._M_base() >= __rhs._M_base(); }
template<typename _Key, typename _Compare, typename _Allocator> template<typename _Key, typename _Compare, typename _Allocator>
inline bool inline bool
operator>(const multiset<_Key,_Compare,_Allocator>& __lhs, operator>(const multiset<_Key, _Compare, _Allocator>& __lhs,
const multiset<_Key,_Compare,_Allocator>& __rhs) const multiset<_Key, _Compare, _Allocator>& __rhs)
{ return __lhs._M_base() > __rhs._M_base(); } { return __lhs._M_base() > __rhs._M_base(); }
template<typename _Key, typename _Compare, typename _Allocator> template<typename _Key, typename _Compare, typename _Allocator>
void void
swap(multiset<_Key,_Compare,_Allocator>& __x, swap(multiset<_Key, _Compare, _Allocator>& __x,
multiset<_Key,_Compare,_Allocator>& __y) multiset<_Key, _Compare, _Allocator>& __y)
{ return __x.swap(__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 __debug
} // namespace std } // namespace std
......
// Debugging set implementation -*- C++ -*- // Debugging set implementation -*- C++ -*-
// Copyright (C) 2003, 2004, 2005 // Copyright (C) 2003, 2004, 2005, 2006, 2007
// Free Software Foundation, Inc. // Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
...@@ -49,7 +49,7 @@ namespace __debug ...@@ -49,7 +49,7 @@ namespace __debug
: public _GLIBCXX_STD_D::set<_Key,_Compare,_Allocator>, : public _GLIBCXX_STD_D::set<_Key,_Compare,_Allocator>,
public __gnu_debug::_Safe_sequence<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; typedef __gnu_debug::_Safe_sequence<set> _Safe_base;
public: public:
...@@ -86,21 +86,37 @@ namespace __debug ...@@ -86,21 +86,37 @@ namespace __debug
: _Base(__gnu_debug::__check_valid_range(__first, __last), __last, : _Base(__gnu_debug::__check_valid_range(__first, __last), __last,
__comp, __a) { } __comp, __a) { }
set(const set<_Key,_Compare,_Allocator>& __x) set(const set& __x)
: _Base(__x), _Safe_base() { } : _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() { }
set<_Key,_Compare,_Allocator>& set&
operator=(const set<_Key,_Compare,_Allocator>& __x) operator=(const set& __x)
{ {
*static_cast<_Base*>(this) = __x; *static_cast<_Base*>(this) = __x;
this->_M_invalidate_all(); this->_M_invalidate_all();
return *this; return *this;
} }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
set&
operator=(set&& __x)
{
swap(__x);
return *this;
}
#endif
using _Base::get_allocator; using _Base::get_allocator;
// iterators: // iterators:
...@@ -200,7 +216,11 @@ namespace __debug ...@@ -200,7 +216,11 @@ namespace __debug
} }
void void
swap(set<_Key,_Compare,_Allocator>& __x) #ifdef __GXX_EXPERIMENTAL_CXX0X__
swap(set&& __x)
#else
swap(set& __x)
#endif
{ {
_Base::swap(__x); _Base::swap(__x);
this->_M_swap(__x); this->_M_swap(__x);
...@@ -287,45 +307,60 @@ namespace __debug ...@@ -287,45 +307,60 @@ namespace __debug
template<typename _Key, typename _Compare, typename _Allocator> template<typename _Key, typename _Compare, typename _Allocator>
inline bool inline bool
operator==(const set<_Key,_Compare,_Allocator>& __lhs, operator==(const set<_Key, _Compare, _Allocator>& __lhs,
const set<_Key,_Compare,_Allocator>& __rhs) const set<_Key, _Compare, _Allocator>& __rhs)
{ return __lhs._M_base() == __rhs._M_base(); } { return __lhs._M_base() == __rhs._M_base(); }
template<typename _Key, typename _Compare, typename _Allocator> template<typename _Key, typename _Compare, typename _Allocator>
inline bool inline bool
operator!=(const set<_Key,_Compare,_Allocator>& __lhs, operator!=(const set<_Key, _Compare, _Allocator>& __lhs,
const set<_Key,_Compare,_Allocator>& __rhs) const set<_Key, _Compare, _Allocator>& __rhs)
{ return __lhs._M_base() != __rhs._M_base(); } { return __lhs._M_base() != __rhs._M_base(); }
template<typename _Key, typename _Compare, typename _Allocator> template<typename _Key, typename _Compare, typename _Allocator>
inline bool inline bool
operator<(const set<_Key,_Compare,_Allocator>& __lhs, operator<(const set<_Key, _Compare, _Allocator>& __lhs,
const set<_Key,_Compare,_Allocator>& __rhs) const set<_Key, _Compare, _Allocator>& __rhs)
{ return __lhs._M_base() < __rhs._M_base(); } { return __lhs._M_base() < __rhs._M_base(); }
template<typename _Key, typename _Compare, typename _Allocator> template<typename _Key, typename _Compare, typename _Allocator>
inline bool inline bool
operator<=(const set<_Key,_Compare,_Allocator>& __lhs, operator<=(const set<_Key, _Compare, _Allocator>& __lhs,
const set<_Key,_Compare,_Allocator>& __rhs) const set<_Key, _Compare, _Allocator>& __rhs)
{ return __lhs._M_base() <= __rhs._M_base(); } { return __lhs._M_base() <= __rhs._M_base(); }
template<typename _Key, typename _Compare, typename _Allocator> template<typename _Key, typename _Compare, typename _Allocator>
inline bool inline bool
operator>=(const set<_Key,_Compare,_Allocator>& __lhs, operator>=(const set<_Key, _Compare, _Allocator>& __lhs,
const set<_Key,_Compare,_Allocator>& __rhs) const set<_Key, _Compare, _Allocator>& __rhs)
{ return __lhs._M_base() >= __rhs._M_base(); } { return __lhs._M_base() >= __rhs._M_base(); }
template<typename _Key, typename _Compare, typename _Allocator> template<typename _Key, typename _Compare, typename _Allocator>
inline bool inline bool
operator>(const set<_Key,_Compare,_Allocator>& __lhs, operator>(const set<_Key, _Compare, _Allocator>& __lhs,
const set<_Key,_Compare,_Allocator>& __rhs) const set<_Key, _Compare, _Allocator>& __rhs)
{ return __lhs._M_base() > __rhs._M_base(); } { return __lhs._M_base() > __rhs._M_base(); }
template<typename _Key, typename _Compare, typename _Allocator> template<typename _Key, typename _Compare, typename _Allocator>
void void
swap(set<_Key,_Compare,_Allocator>& __x, swap(set<_Key, _Compare, _Allocator>& __x,
set<_Key,_Compare,_Allocator>& __y) set<_Key, _Compare, _Allocator>& __y)
{ return __x.swap(__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 __debug
} // namespace std } // namespace std
......
// Debugging vector implementation -*- C++ -*- // Debugging vector implementation -*- C++ -*-
// Copyright (C) 2003, 2004, 2005 // Copyright (C) 2003, 2004, 2005, 2006, 2007
// Free Software Foundation, Inc. // Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
...@@ -91,17 +91,26 @@ namespace __debug ...@@ -91,17 +91,26 @@ namespace __debug
_M_guaranteed_capacity(0) _M_guaranteed_capacity(0)
{ _M_update_guaranteed_capacity(); } { _M_update_guaranteed_capacity(); }
vector(const vector<_Tp,_Allocator>& __x) vector(const vector& __x)
: _Base(__x), _Safe_base(), _M_guaranteed_capacity(__x.size()) { } : _Base(__x), _Safe_base(), _M_guaranteed_capacity(__x.size()) { }
/// Construction from a release-mode vector /// Construction from a release-mode vector
vector(const _Base& __x) vector(const _Base& __x)
: _Base(__x), _Safe_base(), _M_guaranteed_capacity(__x.size()) { } : _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() { }
vector<_Tp,_Allocator>& vector&
operator=(const vector<_Tp,_Allocator>& __x) operator=(const vector& __x)
{ {
static_cast<_Base&>(*this) = __x; static_cast<_Base&>(*this) = __x;
this->_M_invalidate_all(); this->_M_invalidate_all();
...@@ -109,6 +118,15 @@ namespace __debug ...@@ -109,6 +118,15 @@ namespace __debug
return *this; return *this;
} }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
vector&
operator=(vector&& __x)
{
swap(__x);
return *this;
}
#endif
template<typename _InputIterator> template<typename _InputIterator>
void void
assign(_InputIterator __first, _InputIterator __last) assign(_InputIterator __first, _InputIterator __last)
...@@ -335,7 +353,11 @@ namespace __debug ...@@ -335,7 +353,11 @@ namespace __debug
} }
void void
swap(vector<_Tp,_Allocator>& __x) #ifdef __GXX_EXPERIMENTAL_CXX0X__
swap(vector&& __x)
#else
swap(vector& __x)
#endif
{ {
_Base::swap(__x); _Base::swap(__x);
this->_M_swap(__x); this->_M_swap(__x);
...@@ -417,6 +439,19 @@ namespace __debug ...@@ -417,6 +439,19 @@ namespace __debug
inline void inline void
swap(vector<_Tp, _Alloc>& __lhs, vector<_Tp, _Alloc>& __rhs) swap(vector<_Tp, _Alloc>& __lhs, vector<_Tp, _Alloc>& __rhs)
{ __lhs.swap(__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 __debug
} // namespace std } // namespace std
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment