Boost logo

Boost-Commit :

From: daniel_james_at_[hidden]
Date: 2007-12-08 12:22:53


Author: danieljames
Date: 2007-12-08 12:22:53 EST (Sat, 08 Dec 2007)
New Revision: 41891
URL: http://svn.boost.org/trac/boost/changeset/41891

Log:
Pull 'bucket' out HASH_TABLE_DATA in hash_table_impl.hpp into hash_table.hpp
Text files modified:
   sandbox-branches/unordered-refactor/boost/unordered/detail/hash_table.hpp | 35 +++++++++++++++++++++++++++++++++++
   sandbox-branches/unordered-refactor/boost/unordered/detail/hash_table_impl.hpp | 39 +++++----------------------------------
   2 files changed, 40 insertions(+), 34 deletions(-)

Modified: sandbox-branches/unordered-refactor/boost/unordered/detail/hash_table.hpp
==============================================================================
--- sandbox-branches/unordered-refactor/boost/unordered/detail/hash_table.hpp (original)
+++ sandbox-branches/unordered-refactor/boost/unordered/detail/hash_table.hpp 2007-12-08 12:22:53 EST (Sat, 08 Dec 2007)
@@ -105,6 +105,41 @@
         {
             return std::pair<Dst1, Dst2>(Dst1(x.first), Dst2(x.second));
         }
+
+ // Hash Bucket
+ //
+ // all no throw
+
+ template <typename Alloc>
+ struct bucket
+ {
+ typedef BOOST_DEDUCED_TYPENAME
+ boost::unordered_detail::rebind_wrap<Alloc, bucket>::type
+ bucket_allocator;
+
+ typedef BOOST_DEDUCED_TYPENAME allocator_pointer<bucket_allocator>::type bucket_ptr;
+ typedef bucket_ptr link_ptr;
+ private:
+ bucket& operator=(bucket const&);
+ public:
+ link_ptr next_;
+
+ bucket() : next_()
+ {
+ BOOST_HASH_MSVC_RESET_PTR(next_);
+ }
+
+ bucket(bucket const& x) : next_(x.next_)
+ {
+ // Only copy construct when allocating.
+ BOOST_ASSERT(!x.next_);
+ }
+
+ bool empty() const
+ {
+ return !this->next_;
+ }
+ };
     }
 }
 

Modified: sandbox-branches/unordered-refactor/boost/unordered/detail/hash_table_impl.hpp
==============================================================================
--- sandbox-branches/unordered-refactor/boost/unordered/detail/hash_table_impl.hpp (original)
+++ sandbox-branches/unordered-refactor/boost/unordered/detail/hash_table_impl.hpp 2007-12-08 12:22:53 EST (Sat, 08 Dec 2007)
@@ -22,9 +22,13 @@
         class HASH_TABLE_DATA
         {
         public:
+ typedef bucket<Alloc> bucket;
+ typedef typename bucket::bucket_allocator bucket_allocator;
+ typedef typename bucket::bucket_ptr bucket_ptr;
+ typedef typename bucket::link_ptr link_ptr;
+
             struct node_base;
             struct node;
- struct bucket;
             typedef std::size_t size_type;
 
             typedef Alloc value_allocator;
@@ -35,43 +39,10 @@
             typedef BOOST_DEDUCED_TYPENAME
                 boost::unordered_detail::rebind_wrap<Alloc, node_base>::type
                 node_base_allocator;
- typedef BOOST_DEDUCED_TYPENAME
- boost::unordered_detail::rebind_wrap<Alloc, bucket>::type
- bucket_allocator;
 
             typedef BOOST_DEDUCED_TYPENAME allocator_value_type<Alloc>::type value_type;
             typedef BOOST_DEDUCED_TYPENAME allocator_pointer<node_allocator>::type node_ptr;
- typedef BOOST_DEDUCED_TYPENAME allocator_pointer<bucket_allocator>::type bucket_ptr;
             typedef BOOST_DEDUCED_TYPENAME allocator_reference<value_allocator>::type reference;
- typedef bucket_ptr link_ptr;
-
- // Hash Bucket
- //
- // all no throw
-
- struct bucket
- {
- private:
- bucket& operator=(bucket const&);
- public:
- link_ptr next_;
-
- bucket() : next_()
- {
- BOOST_HASH_MSVC_RESET_PTR(next_);
- }
-
- bucket(bucket const& x) : next_(x.next_)
- {
- // Only copy construct when allocating.
- BOOST_ASSERT(!x.next_);
- }
-
- bool empty() const
- {
- return !this->next_;
- }
- };
 
             // Hash Node
             //


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