$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
From: chintanraoh_at_[hidden]
Date: 2008-06-20 14:45:02
Author: chintanraoh
Date: 2008-06-20 14:45:02 EDT (Fri, 20 Jun 2008)
New Revision: 46568
URL: http://svn.boost.org/trac/boost/changeset/46568
Log:
to_left_most and to_right_most
Text files modified: 
   sandbox/SOC/2008/digital_searching/dsearch/boost/dsearch/patricia_iterator.hpp |    69 +++++++++++++++++++++++++++++++-------- 
   1 files changed, 55 insertions(+), 14 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-06-20 14:45:02 EDT (Fri, 20 Jun 2008)
@@ -11,31 +11,39 @@
 :public iterator_facade< patricia_iterator<Value_type,Node_type, Alloc>, 
 Value_type, bidirectional_traversal_tag >
 {
+	template<class K,class M,class K_t,class A > friend class patricia;
         protected:
         struct enabler {};
         friend class boost::iterator_core_access;
         Node_type *cur;
         Node_type *next;
         
-	void increment()
+	virtual void increment()
         {
-		if (cur == 0 ) return;
-		while ( cur && ( cur->right==next || cur->right==0) )
+		if (cur)
                 {
-			next=cur;
-			cur=cur->par;
+			while ( cur && ( cur->right==next || cur->right==0) )
+			{
+				next=cur;
+				cur=cur->par;
+			}
+			if ( cur == 0) return; //reached end()
+			next=cur->right; //cur->right!=0
+		}
+		else
+		{
+			cur=next;
+			next=(cur->left)?cur->left:cur->right;
                 }
-		if ( cur == 0) return; //reached end()
-		next=cur->right; //cur->right!=0
+
                 while ( next && next->index > cur->index )
                 {
                         cur=next;
-			next=cur->left;
-			if ( next == 0 ) next=cur->right;
+			next=cur->left?cur->left:cur->right;
                 }
         }
 
-	void decrement()
+	virtual void decrement()
         {
                 if(cur)
                 {
@@ -45,7 +53,11 @@
                                 cur=cur->par;
                         }
                         if(cur==0)
+			{
+				//assert(false);
+				//std::cout<<"Reached before begin"<<std::endl;
                                 return;
+			}
                         next=cur->left;
                 }
                 else
@@ -57,8 +69,7 @@
                 while ( next && next->index > cur->index )
                 {
                         cur=next;
-			next=cur->right;
-			if ( next == 0 ) next=cur->left;
+			next=cur->right?cur->right:next=cur->left;
                 }
         }
         
@@ -81,6 +92,30 @@
                 return false;
         }
 
+	private:
+	void to_right_most()
+	{
+		assert(cur);
+		while(next->par==cur)
+		{
+			cur=next;
+			next=cur->right?cur->right:cur->left;
+		}
+	}
+	
+	private:
+	void to_left_most()
+	{
+		assert(cur);
+		while(next->par==cur)
+		{
+			cur=next;
+			next=cur->left?cur->left:cur->right;
+			//std::cout<<"To left most"<<cur->value.first<<"<-"<<next->value.first<<std::endl;
+		}
+		std::cout<<"To left most"<<cur->value.first<<"<-"<<next->value.first<<std::endl;
+	}
+
         public:
         patricia_iterator() : cur(0),next(0)
         {
@@ -131,6 +166,7 @@
 class patricia_reverse_iterator:
 public patricia_iterator<Value_type, Node_type, Alloc>
 {
+	friend class patricia_iterator<Value_type, Node_type, Alloc>;
         typedef patricia_iterator<Value_type, Node_type, Alloc> forward_type;
         private:
         struct enabler {};
@@ -144,6 +180,7 @@
                 forward_type::decrement();
         }
         
+
         template<class V,class N,class A>
         bool equal(patricia_reverse_iterator<V,N,A> const &other,
         typename enable_if< is_convertible<V*,Value_type*>, 
@@ -152,6 +189,7 @@
         {
                 if ( forward_type::cur == other.cur && forward_type::next == other.next )
                         return true;
+		
                 return false;
         }
         
@@ -159,12 +197,14 @@
         {
                 return forward_type::dereference();
         }
+
         public:
         patricia_reverse_iterator(): forward_type()
         {
         }
+
         patricia_reverse_iterator(Node_type *found,Node_type*prev)
-	: forward_type(found,prev)
+	:forward_type(found,prev)
         {
         }
         
@@ -174,9 +214,10 @@
                 forward_type::next=root;
                 if(start)
                 {
-			decrement();
+			forward_type::decrement(); //rbegin()=end()-1
                 }
         }
+
         template<class V,class N,class A>
         patricia_reverse_iterator ( patricia_reverse_iterator<V,N,A> const& other,
                                 typename enable_if< is_convertible<V*,Value_type*>,