diff options
Diffstat (limited to 'libstdc++-v3/include/debug/multiset.h')
-rw-r--r-- | libstdc++-v3/include/debug/multiset.h | 99 |
1 files changed, 77 insertions, 22 deletions
diff --git a/libstdc++-v3/include/debug/multiset.h b/libstdc++-v3/include/debug/multiset.h index a37099e1ac8..ffe5b51548f 100644 --- a/libstdc++-v3/include/debug/multiset.h +++ b/libstdc++-v3/include/debug/multiset.h @@ -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 @@ -46,10 +46,10 @@ namespace __debug template<typename _Key, typename _Compare = std::less<_Key>, typename _Allocator = std::allocator<_Key> > class multiset - : public _GLIBCXX_STD::multiset<_Key, _Compare, _Allocator>, + : public _GLIBCXX_STD_D::multiset<_Key, _Compare, _Allocator>, public __gnu_debug::_Safe_sequence<multiset<_Key, _Compare, _Allocator> > { - typedef _GLIBCXX_STD::multiset<_Key, _Compare, _Allocator> _Base; + typedef _GLIBCXX_STD_D::multiset<_Key, _Compare, _Allocator> _Base; typedef __gnu_debug::_Safe_sequence<multiset> _Safe_base; public: @@ -86,21 +86,39 @@ namespace __debug : _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(std::forward<multiset>(__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) + { + // NB: DR 675. + clear(); + swap(__x); + return *this; + } +#endif + using _Base::get_allocator; // iterators: @@ -136,6 +154,24 @@ namespace __debug rend() const { return const_reverse_iterator(begin()); } +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + const_iterator + cbegin() const + { return const_iterator(_Base::begin(), this); } + + const_iterator + cend() const + { return const_iterator(_Base::end(), this); } + + const_reverse_iterator + crbegin() const + { return const_reverse_iterator(end()); } + + const_reverse_iterator + crend() const + { return const_reverse_iterator(begin()); } +#endif + // capacity: using _Base::empty; using _Base::size; @@ -195,7 +231,11 @@ namespace __debug } 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 +322,60 @@ namespace __debug 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 |