Boost logo

Boost-Commit :

From: chintanraoh_at_[hidden]
Date: 2008-06-03 16:30:53


Author: chintanraoh
Date: 2008-06-03 16:30:52 EDT (Tue, 03 Jun 2008)
New Revision: 46088
URL: http://svn.boost.org/trac/boost/changeset/46088

Log:
Added few private functions to help upper_bound, lower_bound etc..
Text files modified:
   sandbox/SOC/2008/digital_searching/dsearch/boost/dsearch/trie_iterator.hpp | 29 +++++++++++++++++++++++++++--
   1 files changed, 27 insertions(+), 2 deletions(-)

Modified: sandbox/SOC/2008/digital_searching/dsearch/boost/dsearch/trie_iterator.hpp
==============================================================================
--- sandbox/SOC/2008/digital_searching/dsearch/boost/dsearch/trie_iterator.hpp (original)
+++ sandbox/SOC/2008/digital_searching/dsearch/boost/dsearch/trie_iterator.hpp 2008-06-03 16:30:52 EDT (Tue, 03 Jun 2008)
@@ -1,3 +1,5 @@
+#ifndef BOOST_DSEARCH_TRIE_ITERATOR_HPP
+#define BOOST_DSEARCH_TRIE_ITERATOR_HPP
 #include<iostream>
 #include<stack>
 #include<boost/iterator/iterator_facade.hpp>
@@ -18,7 +20,26 @@
         std::stack<Cursor> cur_st;
         typedef trie_iterator<Key,Mapped,Cursor> self;
         friend class boost::iterator_core_access;
+ template<class K,class M,template<class K1,class M1,class K_t1,class A1 > class t_n,class K_t,class A >
+ friend class trie;
         bool end_flag;
+
+ void push(const Cursor &c)
+ {
+ cur_st.push(c);
+ }
+
+ void pop()
+ {
+ cur_st.pop();
+ }
+
+ Cursor &top()
+ {
+ assert(!cur_st.empty());
+ return cur_st.top();
+ }
+
         void to_right_most()
         {
                 Cursor c=cur_st.top();
@@ -85,7 +106,7 @@
 
                 while(cur_st.top().end()==top)
                 {
- top=++cur_st.top();
+ top=cur_st.top();
                         cur_st.pop();
                         if(cur_st.empty())
                         {
@@ -93,6 +114,7 @@
                                 end_flag=true;
                                 return;
                         }
+ ++top;
                 }
                 cur_st.push(top);
                 to_left_most();
@@ -113,7 +135,7 @@
         }
 
         public:
- trie_iterator():end_flag(0) //An end cursor
+ trie_iterator():end_flag(false)
         {
         }
 
@@ -136,6 +158,7 @@
                 cur_st.push(c);
                 to_left_most();
         }
+
         template<class It>
         trie_iterator(const It &begin,const It &end):end_flag(0)
         {
@@ -150,3 +173,5 @@
 
 }
 }
+
+#endif //BOOST_DSEARCH_TRIE_ITERATOR_HPP


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