$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
From: daniel_james_at_[hidden]
Date: 2008-07-17 19:33:52
Author: danieljames
Date: 2008-07-17 19:33:51 EDT (Thu, 17 Jul 2008)
New Revision: 47523
URL: http://svn.boost.org/trac/boost/changeset/47523
Log:
Remove hash_value for unordered containers.
Merged revisions 47463,47465,47522 via svnmerge from 
https://svn.boost.org/svn/boost/trunk
........
  r47463 | danieljames | 2008-07-15 22:26:54 +0100 (Tue, 15 Jul 2008) | 1 line
  
  Better hash function for unordered containers. Still a bit rubbish.
........
  r47465 | danieljames | 2008-07-15 23:03:15 +0100 (Tue, 15 Jul 2008) | 4 lines
  
  On second thoughts, I'll just completely remove hash_value for ordered
  containers. It's low quality and not very generic (it uses boost::hash for
  mapped values). Should be a painless change.
........
  r47522 | danieljames | 2008-07-18 00:08:32 +0100 (Fri, 18 Jul 2008) | 1 line
  
  Remove a mention of the hash functions which I missed before.
........
Properties modified: 
   branches/release/   (props changed)
Text files modified: 
   branches/release/boost/unordered/detail/hash_table_impl.hpp      |    55 ---------------------------             
   branches/release/boost/unordered_map.hpp                         |    20 ----------                              
   branches/release/boost/unordered_set.hpp                         |    20 ----------                              
   branches/release/libs/unordered/doc/changes.qbk                  |     3 -                                       
   branches/release/libs/unordered/doc/rationale.qbk                |     2 -                                       
   branches/release/libs/unordered/doc/ref.xml                      |    80 ----------------------------------------
   branches/release/libs/unordered/test/unordered/compile_tests.hpp |     5 --                                      
   7 files changed, 1 insertions(+), 184 deletions(-)
Modified: branches/release/boost/unordered/detail/hash_table_impl.hpp
==============================================================================
--- branches/release/boost/unordered/detail/hash_table_impl.hpp	(original)
+++ branches/release/boost/unordered/detail/hash_table_impl.hpp	2008-07-17 19:33:51 EDT (Thu, 17 Jul 2008)
@@ -2245,61 +2245,6 @@
             return true;
         }
 
-        //
-        // hash_value - unordered container hash function.
-        //
-
-        template <typename V, typename K, typename H, typename P, typename A>
-        std::size_t group_hash(BOOST_UNORDERED_TABLE<V, K, H, P, A> const& t,
-                typename BOOST_UNORDERED_TABLE_DATA<A>::link_ptr it,
-                type_wrapper<K>*)
-        {
-            typedef BOOST_UNORDERED_TABLE_DATA<A> data;
-            std::size_t seed = data::group_count(it);
-            std::size_t hashed_key = t.hash_function()(data::get_value(it)); 
-            boost::hash_combine(seed, hashed_key);
-            return seed;
-        }
-
-        template <typename V, typename K, typename H, typename P, typename A>
-        std::size_t group_hash(BOOST_UNORDERED_TABLE<V, K, H, P, A> const& t,
-                typename BOOST_UNORDERED_TABLE_DATA<A>::link_ptr it,
-                void*)
-        {
-            typedef BOOST_UNORDERED_TABLE_DATA<A> data;
-            typedef typename data::link_ptr link_ptr;
-
-            std::size_t seed = t.hash_function()(data::get_value(it).first);
-
-            link_ptr end = data::next_group(it);
-
-            do {
-                boost::hash_combine(seed, data::get_value(it).second);
-                it = it->next_;
-            } while(it != end);
-
-            return seed;
-        }
-
-        template <typename V, typename K, typename H, typename P, typename A>
-        std::size_t hash_value(BOOST_UNORDERED_TABLE<V, K, H, P, A> const& t)
-        {
-            typedef BOOST_UNORDERED_TABLE_DATA<A> data;
-            typedef typename data::link_ptr link_ptr;
-            typedef typename data::bucket_ptr bucket_ptr;
-            
-            std::size_t seed = 0;
-
-            for(bucket_ptr i = t.data_.cached_begin_bucket_,
-                        j = t.data_.buckets_end(); i != j; ++i)
-            {
-                for(link_ptr it(i->next_); BOOST_UNORDERED_BORLAND_BOOL(it); it = data::next_group(it))
-                    seed ^= group_hash(t, it, (type_wrapper<V>*)0);
-            }
-
-            return seed;
-        }
-
         // Iterators
 
         template <typename Alloc> class BOOST_UNORDERED_ITERATOR;
Modified: branches/release/boost/unordered_map.hpp
==============================================================================
--- branches/release/boost/unordered_map.hpp	(original)
+++ branches/release/boost/unordered_map.hpp	2008-07-17 19:33:51 EDT (Thu, 17 Jul 2008)
@@ -40,8 +40,6 @@
     bool operator!=(unordered_map<K, T, H, P, A> const&,
         unordered_map<K, T, H, P, A> const&);
     template <class K, class T, class H, class P, class A>
-    std::size_t hash_value(unordered_map<K, T, H, P, A> const&);
-    template <class K, class T, class H, class P, class A>
     void swap(unordered_map<K, T, H, P, A>&,
             unordered_map<K, T, H, P, A>&);
 
@@ -58,8 +56,6 @@
     bool operator!=(unordered_multimap<K, T, H, P, A> const&,
         unordered_multimap<K, T, H, P, A> const&);
     template <class K, class T, class H, class P, class A>
-    std::size_t hash_value(unordered_multimap<K, T, H, P, A> const&);
-    template <class K, class T, class H, class P, class A>
     void swap(unordered_multimap<K, T, H, P, A>&,
             unordered_multimap<K, T, H, P, A>&);
 
@@ -424,11 +420,9 @@
 #if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
         friend bool operator==(unordered_map const&, unordered_map const&);
         friend bool operator!=(unordered_map const&, unordered_map const&);
-        friend std::size_t hash_value(unordered_map const&);
 #else
         friend bool operator==<>(unordered_map const&, unordered_map const&);
         friend bool operator!=<>(unordered_map const&, unordered_map const&);
-        friend std::size_t hash_value<>(unordered_map const&);
 #endif
     }; // class template unordered_map
 
@@ -447,12 +441,6 @@
     }
 
     template <class K, class T, class H, class P, class A>
-    inline std::size_t hash_value(unordered_map<K, T, H, P, A> const& m)
-    {
-        return boost::unordered_detail::hash_value(m.base);
-    }
-
-    template <class K, class T, class H, class P, class A>
     inline void swap(unordered_map<K, T, H, P, A> &m1,
             unordered_map<K, T, H, P, A> &m2)
     {
@@ -804,11 +792,9 @@
 #if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
         friend bool operator==(unordered_multimap const&, unordered_multimap const&);
         friend bool operator!=(unordered_multimap const&, unordered_multimap const&);
-        friend std::size_t hash_value(unordered_multimap const&);
 #else
         friend bool operator==<>(unordered_multimap const&, unordered_multimap const&);
         friend bool operator!=<>(unordered_multimap const&, unordered_multimap const&);
-        friend std::size_t hash_value<>(unordered_multimap const&);
 #endif
     }; // class template unordered_multimap
 
@@ -827,12 +813,6 @@
     }
 
     template <class K, class T, class H, class P, class A>
-    inline std::size_t hash_value(unordered_multimap<K, T, H, P, A> const& m)
-    {
-        return boost::unordered_detail::hash_value(m.base);
-    }
-
-    template <class K, class T, class H, class P, class A>
     inline void swap(unordered_multimap<K, T, H, P, A> &m1,
             unordered_multimap<K, T, H, P, A> &m2)
     {
Modified: branches/release/boost/unordered_set.hpp
==============================================================================
--- branches/release/boost/unordered_set.hpp	(original)
+++ branches/release/boost/unordered_set.hpp	2008-07-17 19:33:51 EDT (Thu, 17 Jul 2008)
@@ -39,8 +39,6 @@
     bool operator!=(unordered_set<T, H, P, A> const&,
         unordered_set<T, H, P, A> const&);
     template <class T, class H, class P, class A>
-    std::size_t hash_value(unordered_set<T, H, P, A> const& m);
-    template <class T, class H, class P, class A>
     void swap(unordered_set<T, H, P, A> &m1,
             unordered_set<T, H, P, A> &m2);
 
@@ -56,8 +54,6 @@
     bool operator!=(unordered_multiset<T, H, P, A> const&,
         unordered_multiset<T, H, P, A> const&);
     template <class T, class H, class P, class A>
-    std::size_t hash_value(unordered_multiset<T, H, P, A> const& m);
-    template <class T, class H, class P, class A>
     void swap(unordered_multiset<T, H, P, A> &m1,
             unordered_multiset<T, H, P, A> &m2);
 
@@ -394,11 +390,9 @@
 #if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
         friend bool operator==(unordered_set const&, unordered_set const&);
         friend bool operator!=(unordered_set const&, unordered_set const&);
-        friend std::size_t hash_value(unordered_set const&);
 #else
         friend bool operator==<>(unordered_set const&, unordered_set const&);
         friend bool operator!=<>(unordered_set const&, unordered_set const&);
-        friend std::size_t hash_value<>(unordered_set const&);
 #endif
     }; // class template unordered_set
 
@@ -417,12 +411,6 @@
     }
 
     template <class T, class H, class P, class A>
-    inline std::size_t hash_value(unordered_set<T, H, P, A> const& m)
-    {
-        return boost::unordered_detail::hash_value(m.base);
-    }
-
-    template <class T, class H, class P, class A>
     inline void swap(unordered_set<T, H, P, A> &m1,
             unordered_set<T, H, P, A> &m2)
     {
@@ -759,11 +747,9 @@
 #if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
         friend bool operator==(unordered_multiset const&, unordered_multiset const&);
         friend bool operator!=(unordered_multiset const&, unordered_multiset const&);
-        friend std::size_t hash_value(unordered_multiset const&);
 #else
         friend bool operator==<>(unordered_multiset const&, unordered_multiset const&);
         friend bool operator!=<>(unordered_multiset const&, unordered_multiset const&);
-        friend std::size_t hash_value<>(unordered_multiset const&);
 #endif
     }; // class template unordered_multiset
 
@@ -782,12 +768,6 @@
     }
 
     template <class T, class H, class P, class A>
-    inline std::size_t hash_value(unordered_multiset<T, H, P, A> const& m)
-    {
-        return boost::unordered_detail::hash_value(m.base);
-    }
-
-    template <class T, class H, class P, class A>
     inline void swap(unordered_multiset<T, H, P, A> &m1,
             unordered_multiset<T, H, P, A> &m2)
     {
Modified: branches/release/libs/unordered/doc/changes.qbk
==============================================================================
--- branches/release/libs/unordered/doc/changes.qbk	(original)
+++ branches/release/libs/unordered/doc/changes.qbk	2008-07-17 19:33:51 EDT (Thu, 17 Jul 2008)
@@ -31,7 +31,6 @@
 * Emplace support when rvalue references and variadic template are available.
 * More efficient node allocation when rvalue references and variadic template
   are available.
-* Added equality operators and hash functions
-  ([@http://svn.boost.org/trac/boost/ticket/1557 Ticket 1557]).
+* Added equality operators.
 
 [endsect]
Modified: branches/release/libs/unordered/doc/rationale.qbk
==============================================================================
--- branches/release/libs/unordered/doc/rationale.qbk	(original)
+++ branches/release/libs/unordered/doc/rationale.qbk	2008-07-17 19:33:51 EDT (Thu, 17 Jul 2008)
@@ -104,8 +104,6 @@
 differently to the standard associative containers, comparing keys
 using the equality predicate rather than `operator==`. This is inconsistent
 with the other containers but it is probably closer to user's expectations.
-I have also added a `hash_value` free function so that the containers can be
-hashed by [classref boost::hash].
 
 [h2 Active Issues and Proposals]
 
Modified: branches/release/libs/unordered/doc/ref.xml
==============================================================================
--- branches/release/libs/unordered/doc/ref.xml	(original)
+++ branches/release/libs/unordered/doc/ref.xml	2008-07-17 19:33:51 EDT (Thu, 17 Jul 2008)
@@ -702,25 +702,6 @@
                 <para>This is a boost extension.</para>
               </notes>
             </function>
-            <function name="hash_value">
-              <template>
-                <template-type-parameter name="Value">
-                </template-type-parameter>
-                <template-type-parameter name="Hash">
-                </template-type-parameter>
-                <template-type-parameter name="Pred">
-                </template-type-parameter>
-                <template-type-parameter name="Alloc">
-                </template-type-parameter>
-              </template>
-              <parameter name="x">
-                <paramtype>unordered_set<Value, Hash, Pred, Alloc> const&</paramtype>
-              </parameter>
-              <type>std::size_t</type>
-              <notes>
-                <para>This is a boost extension.</para>
-              </notes>
-            </function>
           </free-function-group>
           <free-function-group name="swap">
             <function name="swap">
@@ -1449,25 +1430,6 @@
                 <para>This is a boost extension.</para>
               </notes>
             </function>
-            <function name="hash_value">
-              <template>
-                <template-type-parameter name="Value">
-                </template-type-parameter>
-                <template-type-parameter name="Hash">
-                </template-type-parameter>
-                <template-type-parameter name="Pred">
-                </template-type-parameter>
-                <template-type-parameter name="Alloc">
-                </template-type-parameter>
-              </template>
-              <parameter name="x">
-                <paramtype>unordered_multiset<Value, Hash, Pred, Alloc> const&</paramtype>
-              </parameter>
-              <type>std::size_t</type>
-              <notes>
-                <para>This is a boost extension.</para>
-              </notes>
-            </function>
           </free-function-group>
           <free-function-group name="swap">
             <function name="swap">
@@ -2249,27 +2211,6 @@
                 <para>This is a boost extension.</para>
               </notes>
             </function>
-            <function name="hash_value">
-              <template>
-                <template-type-parameter name="Key">
-                </template-type-parameter>
-                <template-type-parameter name="Mapped">
-                </template-type-parameter>
-                <template-type-parameter name="Hash">
-                </template-type-parameter>
-                <template-type-parameter name="Pred">
-                </template-type-parameter>
-                <template-type-parameter name="Alloc">
-                </template-type-parameter>
-              </template>
-              <parameter name="x">
-                <paramtype>unordered_map<Key, Mapped, Hash, Pred, Alloc> const&</paramtype>
-              </parameter>
-              <type>std::size_t</type>
-              <notes>
-                <para>This is a boost extension.</para>
-              </notes>
-            </function>
           </free-function-group>
           <free-function-group name="swap">
             <function name="swap">
@@ -3012,27 +2953,6 @@
                 <para>This is a boost extension.</para>
               </notes>
             </function>
-            <function name="hash_value">
-              <template>
-                <template-type-parameter name="Key">
-                </template-type-parameter>
-                <template-type-parameter name="Mapped">
-                </template-type-parameter>
-                <template-type-parameter name="Hash">
-                </template-type-parameter>
-                <template-type-parameter name="Pred">
-                </template-type-parameter>
-                <template-type-parameter name="Alloc">
-                </template-type-parameter>
-              </template>
-              <parameter name="x">
-                <paramtype>unordered_multimap<Key, Mapped, Hash, Pred, Alloc> const&</paramtype>
-              </parameter>
-              <type>std::size_t</type>
-              <notes>
-                <para>This is a boost extension.</para>
-              </notes>
-            </function>
           </free-function-group>
           <free-function-group name="swap">
             <function name="swap">
Modified: branches/release/libs/unordered/test/unordered/compile_tests.hpp
==============================================================================
--- branches/release/libs/unordered/test/unordered/compile_tests.hpp	(original)
+++ branches/release/libs/unordered/test/unordered/compile_tests.hpp	2008-07-17 19:33:51 EDT (Thu, 17 Jul 2008)
@@ -168,11 +168,6 @@
 
     test::check_return_type<bool>::equals(a == b);
     test::check_return_type<bool>::equals(a != b);
-#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
-    test::check_return_type<std::size_t>::equals(boost::hash_value(a));
-#else
-    test::check_return_type<std::size_t>::equals(hash_value(a));
-#endif
 }
 
 template <class X, class T>