Exemplo n.º 1
0
 bucket_impl &operator=(const bucket_impl&)
 {
    //This bucket is still in use!
    BOOST_INTRUSIVE_INVARIANT_ASSERT(Slist::empty());
    //Slist::clear();
    return *this;
 }
Exemplo n.º 2
0
 const Container *get_container() const
 {
    if(store_container_ptr){
       const Container* c = static_cast<const Container*>(members_.get_ptr());
       BOOST_INTRUSIVE_INVARIANT_ASSERT(c != 0);
       return c;
    }
    else{
       return 0;
    }
 }
 static node_ptr get_previous_node(node_ptr p, const node_ptr & this_node)
 {
    for( node_ptr p_next
       ; this_node != (p_next = NodeTraits::get_next(p))
       ; p = p_next){
       //Logic error: possible use of linear lists with
       //operations only permitted with lists
       BOOST_INTRUSIVE_INVARIANT_ASSERT(p);
    }
    return p;
 }
Exemplo n.º 4
0
   static void rebalance_after_insertion
      ( node_ptr x, std::size_t depth
      , std::size_t tree_size, H_Alpha h_alpha, std::size_t &max_tree_size)
   {
      if(tree_size > max_tree_size)
         max_tree_size = tree_size;

      if(tree_size != 1 && depth > h_alpha(tree_size)){
         //Find the first non height-balanced node
         //as described in the section 4.2 of the paper.
         //This method is the alternative method described
         //in the paper. Authors claim that this method
         //may tend to yield more balanced trees on the average
         //than the weight balanced method.
         node_ptr s = x;
         std::size_t size = 1;

         for(std::size_t i = 1; true; ++i){
            bool rebalance = false;
            if(i == depth){
               BOOST_INTRUSIVE_INVARIANT_ASSERT(tree_size == count(s));
               rebalance = true;
            }
            else if(i > h_alpha(size)){
               node_ptr s_parent = NodeTraits::get_parent(s);
               node_ptr s_parent_left = NodeTraits::get_left(s_parent);
               size += 1 + tree_algorithms::count
                  ( s_parent_left == s ? NodeTraits::get_right(s_parent) : s_parent_left );
               s = s_parent;
               rebalance = true;
            }
            if(rebalance){
               rebalance_subtree(s);
               break;
            }
         }
      }
   }
Exemplo n.º 5
0
 void set_alpha(float)
 {  //alpha CAN't be changed.
    BOOST_INTRUSIVE_INVARIANT_ASSERT(0);
 }
Exemplo n.º 6
0
 ~bucket_impl()
 {
    //This bucket is still being used!
    BOOST_INTRUSIVE_INVARIANT_ASSERT(Slist::empty());
 }
Exemplo n.º 7
0
 static void set_bits(pointer &n, std::size_t c)
 {
    BOOST_INTRUSIVE_INVARIANT_ASSERT(c <= Mask);
    n = pointer(std::size_t(get_pointer(n)) | c);
 }
Exemplo n.º 8
0
 static void set_pointer(pointer &n, pointer p)
 {
    BOOST_INTRUSIVE_INVARIANT_ASSERT(0 == (std::size_t(p) & Mask));
    n = pointer(std::size_t(p) | (std::size_t(n) & Mask)); 
 }
Exemplo n.º 9
0
    void operator()(Pointer p)
 {
    typedef typename std::iterator_traits<Pointer>::value_type value_type;
    BOOST_INTRUSIVE_INVARIANT_ASSERT(( detail::is_same<T, value_type>::value ));
    delete detail::get_pointer(p); 
 }
 BOOST_INTRUSIVE_FORCEINLINE static void set_bits(pointer &n, std::size_t c)
 {
    BOOST_INTRUSIVE_INVARIANT_ASSERT(uintptr_t(c) <= Mask);
    n = pointer(uintptr_t((get_pointer)(n)) | uintptr_t(c));
 }
 BOOST_INTRUSIVE_FORCEINLINE static void set_pointer(pointer &n, pointer p)
 {
    BOOST_INTRUSIVE_INVARIANT_ASSERT(0 == (uintptr_t(p) & Mask));
    n = pointer(uintptr_t(p) | (uintptr_t(n) & Mask));
 }