Ignore:
Timestamp:
Apr 22, 2008, 8:29:12 PM (10 years ago)
Author:
Eric Niebler
Message:

Merged revisions 44678-44679,44681-44689,44691-44692,44694,44697-44699,44704-44707,44711,44715,44717-44719,44722 via svnmerge from
https://svn.boost.org/svn/boost/trunk

........

r44678 | chris_kohlhoff | 2008-04-20 22:43:42 -0700 (Sun, 20 Apr 2008) | 3 lines


Add porthopper example to demonstrate applications that mix synchronous and
asynchronous operations.

........

r44679 | chris_kohlhoff | 2008-04-20 22:52:20 -0700 (Sun, 20 Apr 2008) | 3 lines


Remove a local variable that was hiding the ec parameter and preventing
error codes from being correctly propagated. Fixes #1820.

........

r44681 | chris_kohlhoff | 2008-04-20 23:14:29 -0700 (Sun, 20 Apr 2008) | 2 lines


Ensure all non-friend related functions are included in the documentation.

........

r44682 | chris_kohlhoff | 2008-04-20 23:15:17 -0700 (Sun, 20 Apr 2008) | 3 lines


Add UNIX domain sockets, POSIX stream-oriented descriptors and Windows
stream-oriented handles to the reference documentation.

........

r44683 | chris_kohlhoff | 2008-04-20 23:15:50 -0700 (Sun, 20 Apr 2008) | 2 lines


Regenerate documentation.

........

r44684 | chris_kohlhoff | 2008-04-20 23:20:32 -0700 (Sun, 20 Apr 2008) | 3 lines


Add documentation on the limits of the number of buffers that may be
transferred in individual operations.

........

r44685 | chris_kohlhoff | 2008-04-21 00:59:21 -0700 (Mon, 21 Apr 2008) | 3 lines


Add requirements for handle and descriptor services. Add new classes to the
quickref index page.

........

r44686 | jhunold | 2008-04-21 01:07:55 -0700 (Mon, 21 Apr 2008) | 2 lines


Remove trailing comma at end of enumerator list (gcc 4.x -pedantic error)

........

r44687 | johnmaddock | 2008-04-21 01:46:18 -0700 (Mon, 21 Apr 2008) | 1 line


Oops fix typo.

........

r44688 | johnmaddock | 2008-04-21 01:47:04 -0700 (Mon, 21 Apr 2008) | 1 line


Fix msvc warnings using new warning suppression header.

........

r44689 | johnmaddock | 2008-04-21 02:19:30 -0700 (Mon, 21 Apr 2008) | 1 line


Added new macro BOOST_NO_TEMPLATED_IOSTREAMS in response to issue #1765.

........

r44691 | speedsnail | 2008-04-21 04:46:03 -0700 (Mon, 21 Apr 2008) | 1 line


removed act-as-jamfile, which gives errors when boost.use-project is not invoked from Jamroot file.

........

r44692 | johnmaddock | 2008-04-21 05:06:02 -0700 (Mon, 21 Apr 2008) | 2 lines


Changed macro BOOST_PARTIAL_SPECIALIZATION_EXPLICIT_ARGS to BOOST_NO_PARTIAL_SPECIALIZATION_DEFAULT_ARGS.
Changed <utility> to <boost/config/no_tr1/utility.hpp> in order to prevent cyclic dependencies between Fusion Tuples and TR1.

........

r44694 | johnmaddock | 2008-04-21 06:00:16 -0700 (Mon, 21 Apr 2008) | 2 lines


Merged changes from the Sandbox, and rebuilt the docs.
Also added some missing files.

........

r44697 | danieljames | 2008-04-21 08:55:40 -0700 (Mon, 21 Apr 2008) | 1 line


Factor out the code for choosing the bucket count, and which bucket that hash values map to make it easier to experiment with alternative policies.

........

r44698 | anthonyw | 2008-04-21 09:20:31 -0700 (Mon, 21 Apr 2008) | 1 line


added private copy assignment operator and copy constructor to remove warnings

........

r44699 | anthonyw | 2008-04-21 09:22:16 -0700 (Mon, 21 Apr 2008) | 1 line


Revamped condition variable to try and fix swallowed-notify problems (trac issue #1834)

........

r44704 | pdimov | 2008-04-21 14:29:28 -0700 (Mon, 21 Apr 2008) | 1 line


Add ref_fn_test.cpp per #1846.

........

r44705 | pdimov | 2008-04-21 14:42:29 -0700 (Mon, 21 Apr 2008) | 1 line


Fix #1846.

........

r44706 | emildotchevski | 2008-04-21 15:42:54 -0700 (Mon, 21 Apr 2008) | 1 line


Fixed MSVC-specific compile errors when /Za command-line option is used, due to lack of throw() in std::~exception().

........

r44707 | pdimov | 2008-04-21 16:01:51 -0700 (Mon, 21 Apr 2008) | 1 line


Honor BOOST_NO_TEMPLATED_IOSTREAMS.

........

r44711 | daniel_frey | 2008-04-21 23:31:32 -0700 (Mon, 21 Apr 2008) | 1 line


Avoid unneccessary increment/decrement of reference count

........

r44715 | johnmaddock | 2008-04-22 01:34:43 -0700 (Tue, 22 Apr 2008) | 1 line


Added new files.

........

r44717 | dgregor | 2008-04-22 05:24:25 -0700 (Tue, 22 Apr 2008) | 1 line


Resource-constrained shortest paths, from Michael Drexl

........

r44718 | hkaiser | 2008-04-22 07:13:58 -0700 (Tue, 22 Apr 2008) | 2 lines


Spirit: Started to add '#include <boost/config/warning_disable.hpp>' to tests and examples.

........

r44719 | hkaiser | 2008-04-22 08:10:52 -0700 (Tue, 22 Apr 2008) | 1 line


Spirit.Support: Minor change

........

r44722 | hkaiser | 2008-04-22 10:23:21 -0700 (Tue, 22 Apr 2008) | 1 line


Wave: fixed #1843

........

Location:
branches/proto/v4
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/proto/v4

  • branches/proto/v4/boost/unordered/detail/hash_table_impl.hpp

    r44680 r44725  
    313313            allocators allocators_;
    314314            bucket_ptr buckets_;
    315             size_type bucket_count_;
     315            bucket_manager bucket_manager_;
    316316            bucket_ptr cached_begin_bucket_;
    317             size_type size_;
     317            size_type size_;           
    318318
    319319            // Constructors/Deconstructor
     
    321321            BOOST_UNORDERED_TABLE_DATA(size_type n, value_allocator const& a)
    322322              : allocators_(a),
    323                 buckets_(), bucket_count_(next_prime(n)),
     323                buckets_(), bucket_manager_(n),
    324324                cached_begin_bucket_(), size_(0)
    325325            {
     
    330330            BOOST_UNORDERED_TABLE_DATA(BOOST_UNORDERED_TABLE_DATA const& x, size_type n)
    331331              : allocators_(x.allocators_),
    332                 buckets_(), bucket_count_(next_prime(n)),
     332                buckets_(), bucket_manager_(n),
    333333                cached_begin_bucket_(), size_(0)
    334334            {
     
    339339            BOOST_UNORDERED_TABLE_DATA(BOOST_UNORDERED_TABLE_DATA& x, move_tag)
    340340                : allocators_(x.allocators_),
    341                 buckets_(x.buckets_), bucket_count_(x.bucket_count_),
     341                buckets_(x.buckets_), bucket_manager_(x.bucket_manager_),
    342342                cached_begin_bucket_(x.cached_begin_bucket_), size_(x.size_)
    343343            {
     
    347347            BOOST_UNORDERED_TABLE_DATA(BOOST_UNORDERED_TABLE_DATA& x,
    348348                    value_allocator const& a, size_type n, move_tag)
    349                 : allocators_(a), buckets_(), bucket_count_(),
     349                : allocators_(a), buckets_(), bucket_manager_(),
    350350                cached_begin_bucket_(), size_(0)
    351351            {
    352352                if(allocators_ == x.allocators_) {
    353353                    buckets_ = x.buckets_;
    354                     bucket_count_ = x.bucket_count_;
     354                    bucket_manager_ = x.bucket_manager_;
    355355                    cached_begin_bucket_ = x.cached_begin_bucket_;
    356356                    size_ = x.size_;
     
    359359                else {
    360360                    BOOST_UNORDERED_MSVC_RESET_PTR(buckets_);
    361                     bucket_count_ = next_prime(n);
     361                    bucket_manager_ = bucket_manager(n);
    362362                    create_buckets();
    363363                }
     
    371371
    372372            void create_buckets() {
     373                size_type bucket_count = bucket_manager_.bucket_count();
     374           
    373375                // The array constructor will clean up in the event of an
    374376                // exception.
     
    377379
    378380                // Creates an extra bucket to act as a sentinel.
    379                 constructor.construct(bucket(), bucket_count_ + 1);
    380 
    381                 cached_begin_bucket_ = constructor.get() + static_cast<difference_type>(bucket_count_);
     381                constructor.construct(bucket(), bucket_count + 1);
     382
     383                cached_begin_bucket_ = constructor.get() + static_cast<difference_type>(bucket_count);
    382384
    383385                // Set up the sentinel.
     
    405407                        allocators_.bucket_alloc_.destroy(begin);
    406408
    407                     allocators_.bucket_alloc_.deallocate(buckets_, bucket_count_ + 1);
     409                    allocators_.bucket_alloc_.deallocate(buckets_,
     410                        bucket_manager_.bucket_count() + 1);
    408411                }
    409412            }
     
    420423            {
    421424                std::swap(buckets_, other.buckets_);
    422                 std::swap(bucket_count_, other.bucket_count_);
     425                std::swap(bucket_manager_, other.bucket_manager_);
    423426                std::swap(cached_begin_bucket_, other.cached_begin_bucket_);
    424427                std::swap(size_, other.size_);
     
    431434                buckets_ = other.buckets_;
    432435                unordered_detail::reset(other.buckets_);
    433                 bucket_count_ = other.bucket_count_;
     436                bucket_manager_ = other.bucket_manager_;
    434437                cached_begin_bucket_ = other.cached_begin_bucket_;
    435438                size_ = other.size_;
    436439            }
    437440
     441            // Return the bucket number for a hashed value.
     442            //
     443            // no throw
     444            size_type bucket_from_hash(size_type hashed) const
     445            {
     446                return bucket_manager_.bucket_from_hash(hashed);
     447            }
     448
    438449            // Return the bucket for a hashed value.
    439450            //
    440451            // no throw
    441             bucket_ptr bucket_from_hash(size_type hashed) const
    442             {
    443                 return buckets_ + static_cast<difference_type>(hashed % bucket_count_);
     452            bucket_ptr bucket_ptr_from_hash(size_type hashed) const
     453            {
     454                return buckets_ + static_cast<difference_type>(
     455                    bucket_manager_.bucket_from_hash(hashed));
    444456            }
    445457
     
    450462            bucket_ptr buckets_end() const
    451463            {
    452                 return buckets_ + static_cast<difference_type>(bucket_count_);
     464                return buckets_ + static_cast<difference_type>(bucket_manager_.bucket_count());
    453465            }
    454466
     
    12831295            {
    12841296                // hash_function can throw:
    1285                 return hash_function()(k) % data_.bucket_count_;
     1297                return data_.bucket_from_hash(hash_function()(k));
    12861298            }
    12871299
     
    12961308            size_type bucket_count() const
    12971309            {
    1298                 return data_.bucket_count_;
     1310                return data_.bucket_manager_.bucket_count();
    12991311            }
    13001312
     
    13321344                // Only resize when size >= mlf_ * count
    13331345                max_load_ = double_to_size_t(ceil(
    1334                         (double) mlf_ * data_.bucket_count_));
     1346                        (double) mlf_ * data_.bucket_manager_.bucket_count()));
    13351347            }
    13361348
     
    13841396            float load_factor() const
    13851397            {
    1386                 BOOST_ASSERT(data_.bucket_count_ != 0);
     1398                BOOST_ASSERT(data_.bucket_manager_.bucket_count() != 0);
    13871399                return static_cast<float>(data_.size_)
    1388                     / static_cast<float>(data_.bucket_count_);
     1400                    / static_cast<float>(data_.bucket_manager_.bucket_count());
    13891401            }
    13901402
     
    14661478
    14671479                        // This next line throws iff the hash function throws.
    1468                         bucket_ptr dst_bucket = dst.bucket_from_hash(
     1480                        bucket_ptr dst_bucket = dst.bucket_ptr_from_hash(
    14691481                                hf(extract_key(data::get_value(src_bucket->next_))));
    14701482
     
    14921504                            BOOST_UNORDERED_BORLAND_BOOL(it); it = data::next_group(it)) {
    14931505                        // hash function can throw.
    1494                         bucket_ptr dst_bucket = dst.bucket_from_hash(
     1506                        bucket_ptr dst_bucket = dst.bucket_ptr_from_hash(
    14951507                                hf(extract_key(data::get_value(it))));
    14961508                        // throws, strong
     
    15171529                key_type const& k = extract_key(v);
    15181530                size_type hash_value = hash_function()(k);
    1519                 bucket_ptr bucket = data_.bucket_from_hash(hash_value);
     1531                bucket_ptr bucket = data_.bucket_ptr_from_hash(hash_value);
    15201532                link_ptr position = find_iterator(bucket, k);
    15211533
     
    15281540                // throws, strong otherwise.
    15291541                if(reserve(size() + 1))
    1530                     bucket = data_.bucket_from_hash(hash_value);
     1542                    bucket = data_.bucket_ptr_from_hash(hash_value);
    15311543
    15321544                // I'm relying on link_ptr not being invalidated by
     
    16411653
    16421654                size_type hash_value = hash_function()(k);
    1643                 bucket_ptr bucket = data_.bucket_from_hash(hash_value);
     1655                bucket_ptr bucket = data_.bucket_ptr_from_hash(hash_value);
    16441656                link_ptr pos = find_iterator(bucket, k);
    16451657
     
    16581670                    // throws, strong otherwise.
    16591671                    if(reserve(size() + 1))
    1660                         bucket = data_.bucket_from_hash(hash_value);
     1672                        bucket = data_.bucket_ptr_from_hash(hash_value);
    16611673
    16621674                    // Nothing after this point can throw.
     
    16751687                key_type const& k = extract_key(v);
    16761688                size_type hash_value = hash_function()(k);
    1677                 bucket_ptr bucket = data_.bucket_from_hash(hash_value);
     1689                bucket_ptr bucket = data_.bucket_ptr_from_hash(hash_value);
    16781690                link_ptr pos = find_iterator(bucket, k);
    16791691
     
    16951707                    // throws, strong otherwise.
    16961708                    if(reserve(size() + 1))
    1697                         bucket = data_.bucket_from_hash(hash_value);
     1709                        bucket = data_.bucket_ptr_from_hash(hash_value);
    16981710
    16991711                    // Nothing after this point can throw.
     
    17501762                    // No side effects in this initial code
    17511763                    size_type hash_value = hash_function()(extract_key(*i));
    1752                     bucket_ptr bucket = data_.bucket_from_hash(hash_value);
     1764                    bucket_ptr bucket = data_.bucket_ptr_from_hash(hash_value);
    17531765                    link_ptr pos = find_iterator(bucket, extract_key(*i));
    17541766
     
    17651777                        if(size() + 1 >= max_load_) {
    17661778                            reserve(size() + insert_size(i, j));
    1767                             bucket = data_.bucket_from_hash(hash_value);
     1779                            bucket = data_.bucket_ptr_from_hash(hash_value);
    17681780                        }
    17691781
     
    20432055#undef BOOST_UNORDERED_LOCAL_ITERATOR
    20442056#undef BOOST_UNORDERED_CONST_LOCAL_ITERATOR
    2045 
Note: See TracChangeset for help on using the changeset viewer.