From 69b3331e2ae2122a638e373bb858c2d9b1b94f3b Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Mon, 3 Dec 2007 13:12:51 +0000 Subject: [PATCH] unordered_map (operator==(const unordered_map&, const unordered_map&), [...]): Remove. 2007-12-03 Paolo Carlini * include/debug/unordered_map (operator==(const unordered_map&, const unordered_map&), operator!=(const unordered_map&, const unordered_map&), operator==(const unordered_multimap&, const unordered_multimap&), operator!=(const unordered_multimap&, const unordered_multimap&)): Remove. (unordered_map<>::unordered_map(unordered_map&&), operator=(unordered_map&&), clear, _M_invalidate_all, unordered_multimap<>::unordered_multimap(unordered_multimap&&), operator=(unordered_map&&), clear, _M_invalidate_all, swap(unordered_map<>&&, unordered_map<>&), swap(unordered_map<>&, unordered_map<>&&), swap(unordered_multimap<>&&, unordered_multimap<>&), swap(unordered_multimap<>&, unordered_multimap<>&&)): Add. * include/debug/unordered_set (operator==(const unordered_set&, const unordered_set&), operator!=(const unordered_set&, const unordered_set&), operator==(const unordered_multiset&, const unordered_multiset&), operator!=(const unordered_multiset&, const unordered_multiset&)): Remove. (unordered_set<>::unordered_set(unordered_set&&), operator=(unordered_set&&), clear, _M_invalidate_all, unordered_multiset<>::unordered_multiset(unordered_multiset&&), operator=(unordered_set&&), clear, _M_invalidate_all, swap(unordered_set<>&&, unordered_set<>&), swap(unordered_set<>&, unordered_set<>&&), swap(unordered_multiset<>&&, unordered_multiset<>&), swap(unordered_multiset<>&, unordered_multiset<>&&)): Add. * include/debug/safe_association.h (_Safe_association<>:: _Safe_association(_Safe_association&&)): Add. (_Safe_association<>::clear, _M_invalidate_all): Remove. From-SVN: r130581 --- libstdc++-v3/ChangeLog | 32 +++++++++ libstdc++-v3/include/debug/safe_association.h | 22 ++---- libstdc++-v3/include/debug/unordered_map | 99 +++++++++++++++++++++------ libstdc++-v3/include/debug/unordered_set | 99 +++++++++++++++++++++------ 4 files changed, 191 insertions(+), 61 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 2c5ba2e..e76767b 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,35 @@ +2007-12-03 Paolo Carlini + + * include/debug/unordered_map (operator==(const unordered_map&, + const unordered_map&), operator!=(const unordered_map&, + const unordered_map&), operator==(const unordered_multimap&, + const unordered_multimap&), operator!=(const unordered_multimap&, + const unordered_multimap&)): Remove. + (unordered_map<>::unordered_map(unordered_map&&), + operator=(unordered_map&&), clear, _M_invalidate_all, + unordered_multimap<>::unordered_multimap(unordered_multimap&&), + operator=(unordered_map&&), clear, _M_invalidate_all, + swap(unordered_map<>&&, unordered_map<>&), swap(unordered_map<>&, + unordered_map<>&&), swap(unordered_multimap<>&&, + unordered_multimap<>&), swap(unordered_multimap<>&, + unordered_multimap<>&&)): Add. + * include/debug/unordered_set (operator==(const unordered_set&, + const unordered_set&), operator!=(const unordered_set&, + const unordered_set&), operator==(const unordered_multiset&, + const unordered_multiset&), operator!=(const unordered_multiset&, + const unordered_multiset&)): Remove. + (unordered_set<>::unordered_set(unordered_set&&), + operator=(unordered_set&&), clear, _M_invalidate_all, + unordered_multiset<>::unordered_multiset(unordered_multiset&&), + operator=(unordered_set&&), clear, _M_invalidate_all, + swap(unordered_set<>&&, unordered_set<>&), swap(unordered_set<>&, + unordered_set<>&&), swap(unordered_multiset<>&&, + unordered_multiset<>&), swap(unordered_multiset<>&, + unordered_multiset<>&&)): Add. + * include/debug/safe_association.h (_Safe_association<>:: + _Safe_association(_Safe_association&&)): Add. + (_Safe_association<>::clear, _M_invalidate_all): Remove. + 2007-12-01 Paolo Carlini * include/tr1_impl/hashtable_policy.h (struct _LessThan): Remove. diff --git a/libstdc++-v3/include/debug/safe_association.h b/libstdc++-v3/include/debug/safe_association.h index dcb9ab4..42c0500 100644 --- a/libstdc++-v3/include/debug/safe_association.h +++ b/libstdc++-v3/include/debug/safe_association.h @@ -1,7 +1,6 @@ // Safe associated container base class implementation -*- C++ -*- -// Copyright (C) 2007 -// Free Software Foundation, Inc. +// Copyright (C) 2007 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -108,6 +107,9 @@ namespace __gnu_debug _Safe_association(const _Base& __x) : _Base(__x) { } + _Safe_association(_Safe_association&& __x) + : _Base(std::forward<_Base>(__x)) { } + using _Base::size; using _Base::max_size; using _Base::empty; @@ -197,27 +199,11 @@ namespace __gnu_debug return iterator(_Base::erase(__first.base(), __last.base())); } - void - clear() - { - _Base::clear(); - this->_M_invalidate_all(); - } - _Base& _M_base() { return *this; } const _Base& _M_base() const { return *this; } - - private: - void - _M_invalidate_all() - { - typedef typename _Base::const_iterator _Base_const_iterator; - typedef __gnu_debug::_Not_equal_to<_Base_const_iterator> _Not_equal; - this->_M_invalidate_if(_Not_equal(_M_base().end())); - } }; } // namespace __gnu_debug diff --git a/libstdc++-v3/include/debug/unordered_map b/libstdc++-v3/include/debug/unordered_map index a88a972..590d4a3 100644 --- a/libstdc++-v3/include/debug/unordered_map +++ b/libstdc++-v3/include/debug/unordered_map @@ -1,6 +1,6 @@ // Debugging unordered_map/unordered_multimap implementation -*- C++ -*- -// Copyright (C) 2003, 2005, 2007 +// 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,33 +88,61 @@ namespace __debug unordered_map(const _Safe_assoc& __x) : _Safe_assoc(__x), _Safe_base() { } + unordered_map(unordered_map&& __x) + : _Safe_assoc(std::forward<_Safe_assoc>(__x)), _Safe_base() { } + + unordered_map& + operator=(unordered_map&& __x) + { + // NB: DR 675. + clear(); + swap(__x); + return *this; + } + void - swap(unordered_map& __x) + swap(unordered_map&& __x) { _Safe_assoc::swap(__x); _Safe_base::_M_swap(__x); } + + void + clear() + { + _Base::clear(); + this->_M_invalidate_all(); + } + + private: + void + _M_invalidate_all() + { + typedef typename _Base::const_iterator _Base_const_iterator; + typedef __gnu_debug::_Not_equal_to<_Base_const_iterator> _Not_equal; + this->_M_invalidate_if(_Not_equal(this->_M_base().end())); + } }; template - inline bool - operator==(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, - const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) - { return __x._M_base() == __y._M_base(); } + inline void + swap(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, + unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) + { __x.swap(__y); } template - inline bool - operator!=(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, - const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) - { return __x._M_base() != __y._M_base(); } + inline void + swap(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>&& __x, + unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) + { __x.swap(__y); } template inline void swap(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, - unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) + unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>&& __y) { __x.swap(__y); } #undef _GLIBCXX_BASE @@ -160,36 +188,63 @@ namespace __debug unordered_multimap(const _Safe_assoc& __x) : _Safe_assoc(__x), _Safe_base() { } + unordered_multimap(unordered_multimap&& __x) + : _Safe_assoc(std::forward<_Safe_assoc>(__x)), _Safe_base() { } + + unordered_multimap& + operator=(unordered_multimap&& __x) + { + // NB: DR 675. + clear(); + swap(__x); + return *this; + } + void - swap(unordered_multimap& __x) + swap(unordered_multimap&& __x) { _Safe_assoc::swap(__x); _Safe_base::_M_swap(__x); } + + void + clear() + { + _Base::clear(); + this->_M_invalidate_all(); + } + + private: + void + _M_invalidate_all() + { + typedef typename _Base::const_iterator _Base_const_iterator; + typedef __gnu_debug::_Not_equal_to<_Base_const_iterator> _Not_equal; + this->_M_invalidate_if(_Not_equal(this->_M_base().end())); + } }; template - inline bool - operator==(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, - const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) - { return __x._M_base() == __y._M_base(); } + inline void + swap(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, + unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) + { __x.swap(__y); } template - inline bool - operator!=(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, - const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) - { return __x._M_base() != __y._M_base(); } + inline void + swap(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>&& __x, + unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) + { __x.swap(__y); } template inline void swap(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, - unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) + unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>&& __y) { __x.swap(__y); } - } // namespace __debug } // namespace std diff --git a/libstdc++-v3/include/debug/unordered_set b/libstdc++-v3/include/debug/unordered_set index a49b4b0..b4b9be8 100644 --- a/libstdc++-v3/include/debug/unordered_set +++ b/libstdc++-v3/include/debug/unordered_set @@ -1,6 +1,6 @@ // Debugging unordered_set/unordered_multiset implementation -*- C++ -*- -// Copyright (C) 2003, 2005, 2007 +// 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 @@ -89,30 +89,58 @@ namespace __debug unordered_set(const _Safe_assoc& __x) : _Safe_assoc(__x), _Safe_base() { } + unordered_set(unordered_set&& __x) + : _Safe_assoc(std::forward<_Safe_assoc>(__x)), _Safe_base() { } + + unordered_set& + operator=(unordered_set&& __x) + { + // NB: DR 675. + clear(); + swap(__x); + return *this; + } + void - swap(unordered_set& __x) + swap(unordered_set&& __x) { _Safe_assoc::swap(__x); _Safe_base::_M_swap(__x); } + + void + clear() + { + _Base::clear(); + this->_M_invalidate_all(); + } + + private: + void + _M_invalidate_all() + { + typedef typename _Base::const_iterator _Base_const_iterator; + typedef __gnu_debug::_Not_equal_to<_Base_const_iterator> _Not_equal; + this->_M_invalidate_if(_Not_equal(this->_M_base().end())); + } }; template - inline bool - operator==(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x, - const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y) - { return __x._M_base() == __y._M_base(); } + inline void + swap(unordered_set<_Value, _Hash, _Pred, _Alloc>& __x, + unordered_set<_Value, _Hash, _Pred, _Alloc>& __y) + { __x.swap(__y); } template - inline bool - operator!=(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x, - const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y) - { return __x._M_base() != __y._M_base(); } + inline void + swap(unordered_set<_Value, _Hash, _Pred, _Alloc>&& __x, + unordered_set<_Value, _Hash, _Pred, _Alloc>& __y) + { __x.swap(__y); } template inline void swap(unordered_set<_Value, _Hash, _Pred, _Alloc>& __x, - unordered_set<_Value, _Hash, _Pred, _Alloc>& __y) + unordered_set<_Value, _Hash, _Pred, _Alloc>&& __y) { __x.swap(__y); } #undef _GLIBCXX_BASE @@ -158,31 +186,60 @@ namespace __debug unordered_multiset(const _Safe_assoc& __x) : _Safe_assoc(__x), _Safe_base() { } + unordered_multiset(unordered_multiset&& __x) + : _Safe_assoc(std::forward<_Safe_assoc>(__x)), _Safe_base() { } + + unordered_multiset& + operator=(unordered_multiset&& __x) + { + // NB: DR 675. + clear(); + swap(__x); + return *this; + } + void - swap(unordered_multiset& __x) + swap(unordered_multiset&& __x) { _Safe_assoc::swap(__x); _Safe_base::_M_swap(__x); } + + void + clear() + { + _Base::clear(); + this->_M_invalidate_all(); + } + + private: + void + _M_invalidate_all() + { + typedef typename _Base::const_iterator _Base_const_iterator; + typedef __gnu_debug::_Not_equal_to<_Base_const_iterator> _Not_equal; + this->_M_invalidate_if(_Not_equal(this->_M_base().end())); + } }; template - inline bool - operator==(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x, - const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y) - { return __x._M_base() == __y._M_base(); } + inline void + swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x, + unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y) + { __x.swap(__y); } template - inline bool - operator!=(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x, - const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y) - { return __x._M_base() != __y._M_base(); } + inline void + swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>&& __x, + unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y) + { __x.swap(__y); } template inline void swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x, - unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y) + unordered_multiset<_Value, _Hash, _Pred, _Alloc>&& __y) { __x.swap(__y); } + } // namespace __debug } // namespace std -- 2.7.4