예제 #1
0
 inline BOOST_DEDUCED_TYPENAME hash_unique_table<H, P, A, K>::node_ptr
     hash_unique_table<H, P, A, K>::add_node(node_constructor& a,
         bucket_ptr bucket)
 {
     node_ptr n = a.release();
     node::add_to_bucket(n, *bucket);
     ++this->size_;
     if(bucket < this->cached_begin_bucket_)
         this->cached_begin_bucket_ = bucket;
     return n;
 }
예제 #2
0
     inline node_ptr add_node(
             node_constructor& a,
             std::size_t bucket_index,
             std::size_t hash,
             node_ptr pos)
     {
         node_ptr n = a.release();
         node::set_hash(n, hash);
 
         if(BOOST_UNORDERED_BORLAND_BOOL(pos)) {
             node::add_after_node(n, pos);
             if (n->next_) {
                 std::size_t next_bucket =
                     node::get_hash(n->next_) % this->bucket_count_;
                 if (next_bucket != bucket_index) {
                     this->buckets_[next_bucket].next_ = n;
                 }
             }
         }
         else {
             bucket_ptr b = this->get_bucket(bucket_index);
 
             if (!b->next_)
             {
                 bucket_ptr start_node =
                     this->get_bucket(this->bucket_count_);
                 
                 if (BOOST_UNORDERED_BORLAND_BOOL(start_node->next_)) {
                     this->buckets_[
                         node::get_hash(start_node->next_) %
                             this->bucket_count_].next_ = n;
                 }
 
                 b->next_ = start_node;
                 n->next_ = start_node->next_;
                 start_node->next_ = n;
             }
             else
             {
                 n->next_ = b->next_->next_;
                 b->next_->next_ = n;
             }
         }
         ++this->size_;
         return n;
     }