Boost logo

Boost-Commit :

From: chintanraoh_at_[hidden]
Date: 2008-08-07 11:54:25


Author: chintanraoh
Date: 2008-08-07 11:54:25 EDT (Thu, 07 Aug 2008)
New Revision: 48024
URL: http://svn.boost.org/trac/boost/changeset/48024

Log:
bug fixes for iterator and reverse iterator
Text files modified:
   sandbox/SOC/2008/digital_searching/dsearch/boost/dsearch/patricia_iterator.hpp | 21 +++++++++++++--------
   1 files changed, 13 insertions(+), 8 deletions(-)

Modified: sandbox/SOC/2008/digital_searching/dsearch/boost/dsearch/patricia_iterator.hpp
==============================================================================
--- sandbox/SOC/2008/digital_searching/dsearch/boost/dsearch/patricia_iterator.hpp (original)
+++ sandbox/SOC/2008/digital_searching/dsearch/boost/dsearch/patricia_iterator.hpp 2008-08-07 11:54:25 EDT (Thu, 07 Aug 2008)
@@ -104,7 +104,11 @@
          */
         template<class V,class N,class A>
         bool equal(patricia_iterator<V,N,A> const &other) const
- {
+ {
+ #ifdef PAT_DEBUG
+ std::cout<<cur << " " << other.cur << " " << next <<
+ " "<< other.next << std::endl;
+ #endif
                 if ( cur == other.cur && next == other.next )
                         return true;
                 return false;
@@ -133,7 +137,9 @@
                         next=cur->left?cur->left:cur->right;
                         //std::cout<<"To left most"<<cur->value.first<<"<-"<<next->value.first<<std::endl;
                 }
+ #ifdef PAT_DEBUG
                 std::cout<<"To left most"<<cur->value.first<<"<-"<<next->value.first<<std::endl;
+ #endif
         }
 
         public:
@@ -153,8 +159,9 @@
                 {
                         if(root==0)
                         {
+ std::cout<<"root is zero"<<std::endl;
                                 cur=0;
- root=0;
+ next=0;
                                 return;
                         }
                         //*move to the left most wrt root.
@@ -265,18 +272,15 @@
         {
         }
 
-
         ///use to intialize begin or end.
         /**
                  \param root is the patricia's root node
                  \param start specifies start or end
          */
- patricia_reverse_iterator(Node_type *root,bool start)
+ patricia_reverse_iterator(Node_type *root,bool start) : forward_type(root,false)
         {
- forward_type::cur=0;
- forward_type::next=root;
- if(start)
- forward_type::decrement(); ///rbegin()=end()-1
+ if(start && root!=0)
+ forward_type::decrement();
         }
         ///copy constructor for reverse the iterator
         /**
@@ -292,6 +296,7 @@
         : forward_type(other.next,other.cur)
         {
         }
+
 };
 
 }


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