Update of /cvsroot/boost/boost/boost/intrusive/detail
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv25962/detail

Modified Files:
        hashtable_node.hpp list_node.hpp parent_from_member.hpp 
        rbtree_node.hpp slist_node.hpp 
Log Message:
Compilation times improvements

Index: hashtable_node.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/intrusive/detail/hashtable_node.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- hashtable_node.hpp  12 May 2007 12:52:32 -0000      1.2
+++ hashtable_node.hpp  23 May 2007 16:07:03 -0000      1.3
@@ -18,9 +18,13 @@
 #include <boost/assert.hpp>
 #include <boost/intrusive/detail/pointer_to_other.hpp>
 #include <boost/intrusive/circular_list_algorithms.hpp>
+#ifdef BOOST_INTRUSIVE_USE_ITERATOR_FACADE
 #include <boost/iterator/iterator_facade.hpp>
+#endif
+#ifdef BOOST_INTRUSIVE_USE_ITERATOR_ENABLE_IF_CONVERTIBLE
 #include <boost/utility/enable_if.hpp>
 #include <boost/type_traits/is_convertible.hpp>
+#endif
 #include <cstddef>
 
 namespace boost {
@@ -102,6 +106,8 @@
    size_type   buckets_len_;
 };
 
+#ifdef BOOST_INTRUSIVE_USE_ITERATOR_FACADE
+
 template<class Value, class SlistImpl>
 class hashtable_iterator
   : public boost::iterator_facade
@@ -138,6 +144,8 @@
       :  local_it_ (ptr),   bucket_info_ (bucket_info)
    {}
 
+
+   #ifdef BOOST_INTRUSIVE_USE_ITERATOR_ENABLE_IF_CONVERTIBLE
    template <class OtherValue>
    hashtable_iterator(hashtable_iterator<OtherValue, SlistImpl> const& other
                      ,typename boost::enable_if<
@@ -147,6 +155,15 @@
                       )
       :  local_it_(other.local_it_), bucket_info_(other.bucket_info_)
    {}
+   #else
+   template <class OtherValue>
+   hashtable_iterator(hashtable_iterator<OtherValue, SlistImpl> const& other,
+                     typename enable_if<
+                           is_convertible<OtherValue*,T*>
+                     >::type* = 0)
+      :  local_it_(other.local_it_), bucket_info_(other.bucket_info_)
+   {}
+   #endif
 
    const local_iterator &local() const
    { return local_it_; }
@@ -195,6 +212,123 @@
    const_bucket_info_ptr   bucket_info_;
 };
 
+#else
+
+template<class T, class SlistImpl>
+class hashtable_iterator
+  : public std::iterator<std::forward_iterator_tag, T>
+{
+   typedef typename SlistImpl::iterator                        local_iterator;
+   typedef typename SlistImpl::const_iterator                  
const_local_iterator;
+   typedef typename SlistImpl::value_traits::node_ptr          node_ptr;
+   typedef typename SlistImpl::value_traits::const_node_ptr    const_node_ptr;
+
+   typedef bucket_type_impl<SlistImpl>                         bucket_type;
+   typedef typename boost::pointer_to_other
+      < typename SlistImpl::pointer, bucket_type>::type        bucket_ptr;
+   typedef typename boost::pointer_to_other
+      < typename SlistImpl::pointer, const bucket_type>::type  
const_bucket_ptr;
+   typedef detail::bucket_info_impl<SlistImpl>                 bucket_info_t;
+   typedef typename boost::pointer_to_other
+      <bucket_ptr, bucket_info_t>::type                        bucket_info_ptr;
+   typedef typename boost::pointer_to_other
+      <bucket_ptr, const bucket_info_t>::type                  
const_bucket_info_ptr;
+   typedef typename SlistImpl::size_type                       size_type;
+   struct enabler {};
+
+   public:
+   typedef T & reference;
+   typedef T * pointer;
+
+   hashtable_iterator ()
+   {}
+
+   explicit hashtable_iterator(local_iterator ptr, const_bucket_info_ptr 
bucket_info)
+      :  local_it_ (ptr),   bucket_info_ (bucket_info)
+   {}
+
+
+   #ifdef BOOST_INTRUSIVE_USE_ITERATOR_ENABLE_IF_CONVERTIBLE
+   template <class OtherValue>
+   hashtable_iterator(hashtable_iterator<OtherValue, SlistImpl> const& other
+                     ,typename boost::enable_if<
+                              boost::is_convertible<OtherValue*,T*>
+                           , enabler
+                           >::type = enabler()
+                      )
+      :  local_it_(other.local_it_), bucket_info_(other.bucket_info_)
+   {}
+   #else
+   template <class OtherValue>
+   hashtable_iterator(hashtable_iterator<OtherValue, SlistImpl> const& other,
+                     typename enable_if<
+                           is_convertible<OtherValue*,T*>
+                     >::type* = 0)
+      :  local_it_(other.local_it_), bucket_info_(other.bucket_info_)
+   {}
+   #endif
+
+   const local_iterator &local() const
+   { return local_it_; }
+
+   const_node_ptr pointed_node() const
+   { return local_it_.pointed_node(); }
+
+   const const_bucket_info_ptr &bucket_info() const
+   { return bucket_info_; }
+
+   public:
+   hashtable_iterator& operator++() 
+   { increment();   return *this;   }
+   
+   hashtable_iterator operator++(int)
+   {
+      hashtable_iterator result (*this);
+      increment();
+      return result;
+   }
+
+   friend bool operator== (const hashtable_iterator& i, const 
hashtable_iterator& i2)
+   { return i.pointed_node() == i2.pointed_node(); }
+
+   friend bool operator!= (const hashtable_iterator& i, const 
hashtable_iterator& i2)
+   { return !(i == i2); }
+
+   T& operator*() const
+   { return *local_it_; }
+
+   pointer operator->() const
+   { return &(*local_it_); }
+
+   private:
+   void increment()
+   {
+      size_type   buckets_len    = bucket_info_->buckets_len_;
+      const_bucket_ptr  buckets  = bucket_info_->buckets_;
+      const_local_iterator first = 
bucket_type::bucket_to_slist(buckets[0]).cend();
+      const_local_iterator last  = 
bucket_type::bucket_to_slist(buckets[buckets_len]).cend();
+
+      ++local_it_;
+      if(first.pointed_node() <= local_it_.pointed_node() && 
+         local_it_.pointed_node() <= last.pointed_node()){
+         size_type n_bucket = (size_type)
+               bucket_type::get_bucket_num(local_it_, buckets[0], 
buckets[buckets_len]);
+         do{
+            if (++n_bucket == buckets_len){
+               local_it_ = bucket_info_->buckets_->end();
+               break;
+            }
+            local_it_ = 
bucket_type::bucket_to_slist(bucket_info_->buckets_[n_bucket]).begin();
+         }
+         while (local_it_ == 
bucket_type::bucket_to_slist(bucket_info_->buckets_[n_bucket]).end());
+      }
+   }
+
+   local_iterator          local_it_;
+   const_bucket_info_ptr   bucket_info_;
+};
+#endif
+
 }  //namespace detail {
 }  //namespace intrusive {
 }  //namespace boost {

Index: list_node.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/intrusive/detail/list_node.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- list_node.hpp       12 May 2007 12:52:32 -0000      1.2
+++ list_node.hpp       23 May 2007 16:07:03 -0000      1.3
@@ -26,7 +26,6 @@
 #include <boost/utility/enable_if.hpp>
 #include <boost/type_traits/is_convertible.hpp>
 #endif
-#include <cstddef>
 
 namespace boost {
 namespace intrusive {
@@ -94,6 +93,7 @@
       :  node_ (node)
    {}
 
+   #ifdef BOOST_INTRUSIVE_USE_ITERATOR_ENABLE_IF_CONVERTIBLE
    template <class OtherValue>
    list_iterator(list_iterator<OtherValue, ValueTraits> const& other
                 ,typename boost::enable_if<
@@ -103,6 +103,15 @@
                  )
       :  node_(other.pointed_node())
    {}
+   #else
+   template <class OtherValue>
+   list_iterator(list_iterator<OtherValue, ValueTraits> const& other,
+                  typename enable_if<
+                        is_convertible<OtherValue*,T*>
+                  >::type* = 0)
+      :  node_(other.pointed_node())
+   {}
+   #endif
 
    const node_ptr &pointed_node() const
    { return node_; }

Index: parent_from_member.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/intrusive/detail/parent_from_member.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- parent_from_member.hpp      12 May 2007 12:52:32 -0000      1.2
+++ parent_from_member.hpp      23 May 2007 16:07:03 -0000      1.3
@@ -21,11 +21,14 @@
 template<class Parent, class Member>
 std::size_t offset_from_pointer_to_member(const Member Parent::* ptr_to_member)
 {
-   //This works with gcc and msvc
    //The implementation of a pointer to member is compiler dependent.
-   #if defined(BOOST_MSVC) || defined(__GNUC__) || defined(BOOST_INTEL)
+   #if defined(BOOST_MSVC)  || defined(__GNUC__) || \
+       defined(BOOST_INTEL) || defined(__HP_aCC) || \
+       defined(__EDG_VERSION__)
+   //This works with gcc, msvc, edg, ac++
    return *(const std::size_t*)(const void*)&ptr_to_member;
-   #else //CW 9.4
+   #else 
+   //This is the traditional C-front approach: CW 9.4, dmc
    return *(const std::size_t*)(const void*)&ptr_to_member - 1;
    #endif
 }

Index: rbtree_node.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/intrusive/detail/rbtree_node.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- rbtree_node.hpp     12 May 2007 12:52:32 -0000      1.2
+++ rbtree_node.hpp     23 May 2007 16:07:03 -0000      1.3
@@ -16,12 +16,8 @@
 
 #include <boost/intrusive/detail/config_begin.hpp>
 #include <iterator>
-#include <boost/assert.hpp>
 #include <boost/intrusive/detail/pointer_to_other.hpp>
 #include <boost/intrusive/rbtree_algorithms.hpp>
-#include <boost/type_traits/alignment_of.hpp>
-#include <cstddef>
-#include <boost/detail/no_exceptions_support.hpp>
 #ifdef BOOST_INTRUSIVE_USE_ITERATOR_FACADE
 #include <boost/iterator/iterator_facade.hpp>
 #endif
@@ -219,6 +215,7 @@
       :  node_ (node)
    {}
 
+   #ifdef BOOST_INTRUSIVE_USE_ITERATOR_ENABLE_IF_CONVERTIBLE
    template <class OtherValue>
    rbtree_iterator(rbtree_iterator<OtherValue, ValueTraits> const& other
                 ,typename boost::enable_if<
@@ -228,6 +225,15 @@
                  )
       :  node_(other.pointed_node())
    {}
+   #else
+   template <class OtherValue>
+   rbtree_iterator(rbtree_iterator<OtherValue, ValueTraits> const& other,
+                  typename enable_if<
+                        is_convertible<OtherValue*,T*>
+                  >::type* = 0)
+      :  node_(other.pointed_node())
+   {}
+   #endif
 
    const node_ptr &pointed_node() const
    { return node_; }

Index: slist_node.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/intrusive/detail/slist_node.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- slist_node.hpp      12 May 2007 12:52:32 -0000      1.2
+++ slist_node.hpp      23 May 2007 16:07:03 -0000      1.3
@@ -26,7 +26,6 @@
 #include <boost/utility/enable_if.hpp>
 #include <boost/type_traits/is_convertible.hpp>
 #endif
-#include <cstddef>
 
 namespace boost {
 namespace intrusive {
@@ -154,21 +153,26 @@
    explicit slist_iterator(node_ptr node)
       : node_ (node)
    {}
-/*
+
+   #ifdef BOOST_INTRUSIVE_USE_ITERATOR_ENABLE_IF_CONVERTIBLE
    template <class OtherValue>
    slist_iterator(slist_iterator<OtherValue, ValueTraits> const& other
-                ,typename boost::enable_if<
+                 ,typename boost::enable_if<
                         boost::is_convertible<OtherValue*,T*>
                      , enabler
                      >::type = enabler()
-                 )
+                  )
       :  node_(other.pointed_node())
    {}
-*/
+   #else
    template <class OtherValue>
-   slist_iterator(slist_iterator<OtherValue, ValueTraits> const& other)
+   slist_iterator(slist_iterator<OtherValue, ValueTraits> const& other,
+                  typename enable_if<
+                        is_convertible<OtherValue*,T*>
+                  >::type* = 0)
       :  node_(other.pointed_node())
    {}
+   #endif
 
    const node_ptr &pointed_node() const
    { return node_; }


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs

Reply via email to