2007-12-03 Paolo Carlini <pcarlini@suse.de>
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 3 Dec 2007 13:12:51 +0000 (13:12 +0000)
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 3 Dec 2007 13:12:51 +0000 (13:12 +0000)
* 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@130581 138bc75d-0d04-0410-961f-82ee72b054a4

libstdc++-v3/ChangeLog
libstdc++-v3/include/debug/safe_association.h
libstdc++-v3/include/debug/unordered_map
libstdc++-v3/include/debug/unordered_set

index 2c5ba2e..e76767b 100644 (file)
@@ -1,3 +1,35 @@
+2007-12-03  Paolo Carlini  <pcarlini@suse.de>
+
+       * 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  <pcarlini@suse.de>
 
        * include/tr1_impl/hashtable_policy.h (struct _LessThan): Remove.
index dcb9ab4..42c0500 100644 (file)
@@ -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
 
index a88a972..590d4a3 100644 (file)
@@ -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<typename _Key, typename _Tp, typename _Hash,
           typename _Pred, typename _Alloc>
-    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<typename _Key, typename _Tp, typename _Hash,
           typename _Pred, typename _Alloc>
-    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<typename _Key, typename _Tp, typename _Hash,
           typename _Pred, typename _Alloc>
     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<typename _Key, typename _Tp, typename _Hash,
           typename _Pred, typename _Alloc>
-    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<typename _Key, typename _Tp, typename _Hash,
           typename _Pred, typename _Alloc>
-    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<typename _Key, typename _Tp, typename _Hash,
           typename _Pred, typename _Alloc>
     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
 
index a49b4b0..b4b9be8 100644 (file)
@@ -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<typename _Value, typename _Hash, typename _Pred, typename _Alloc>
-    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<typename _Value, typename _Hash, typename _Pred, typename _Alloc>
-    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<typename _Value, typename _Hash, typename _Pred, typename _Alloc>
     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<typename _Value, typename _Hash, typename _Pred, typename _Alloc>
-    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<typename _Value, typename _Hash, typename _Pred, typename _Alloc>
-    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<typename _Value, typename _Hash, typename _Pred, typename _Alloc>
     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