Boost logo

Boost-Commit :

From: daniel_james_at_[hidden]
Date: 2008-07-15 18:03:16


Author: danieljames
Date: 2008-07-15 18:03:15 EDT (Tue, 15 Jul 2008)
New Revision: 47465
URL: http://svn.boost.org/trac/boost/changeset/47465

Log:
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.

Text files modified:
   trunk/boost/unordered/detail/hash_table_impl.hpp | 55 ---------------------------
   trunk/boost/unordered_map.hpp | 20 ----------
   trunk/boost/unordered_set.hpp | 20 ----------
   trunk/libs/unordered/doc/rationale.qbk | 2 -
   trunk/libs/unordered/doc/ref.xml | 80 ----------------------------------------
   trunk/libs/unordered/test/unordered/compile_tests.hpp | 5 --
   6 files changed, 0 insertions(+), 182 deletions(-)

Modified: trunk/boost/unordered/detail/hash_table_impl.hpp
==============================================================================
--- trunk/boost/unordered/detail/hash_table_impl.hpp (original)
+++ trunk/boost/unordered/detail/hash_table_impl.hpp 2008-07-15 18:03:15 EDT (Tue, 15 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: trunk/boost/unordered_map.hpp
==============================================================================
--- trunk/boost/unordered_map.hpp (original)
+++ trunk/boost/unordered_map.hpp 2008-07-15 18:03:15 EDT (Tue, 15 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: trunk/boost/unordered_set.hpp
==============================================================================
--- trunk/boost/unordered_set.hpp (original)
+++ trunk/boost/unordered_set.hpp 2008-07-15 18:03:15 EDT (Tue, 15 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: trunk/libs/unordered/doc/rationale.qbk
==============================================================================
--- trunk/libs/unordered/doc/rationale.qbk (original)
+++ trunk/libs/unordered/doc/rationale.qbk 2008-07-15 18:03:15 EDT (Tue, 15 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: trunk/libs/unordered/doc/ref.xml
==============================================================================
--- trunk/libs/unordered/doc/ref.xml (original)
+++ trunk/libs/unordered/doc/ref.xml 2008-07-15 18:03:15 EDT (Tue, 15 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&lt;Value, Hash, Pred, Alloc&gt; const&amp;</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&lt;Value, Hash, Pred, Alloc&gt; const&amp;</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&lt;Key, Mapped, Hash, Pred, Alloc&gt; const&amp;</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&lt;Key, Mapped, Hash, Pred, Alloc&gt; const&amp;</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: trunk/libs/unordered/test/unordered/compile_tests.hpp
==============================================================================
--- trunk/libs/unordered/test/unordered/compile_tests.hpp (original)
+++ trunk/libs/unordered/test/unordered/compile_tests.hpp 2008-07-15 18:03:15 EDT (Tue, 15 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>


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk