Boost logo

Boost-Commit :

From: chintanraoh_at_[hidden]
Date: 2008-06-06 13:45:48


Author: chintanraoh
Date: 2008-06-06 13:45:47 EDT (Fri, 06 Jun 2008)
New Revision: 46197
URL: http://svn.boost.org/trac/boost/changeset/46197

Log:
rbegin() rend() and thier const counterpart s
Text files modified:
   sandbox/SOC/2008/digital_searching/dsearch/boost/dsearch/trie.hpp | 45 ++++++++++++++++++++++++++++++++++-----
   1 files changed, 39 insertions(+), 6 deletions(-)

Modified: sandbox/SOC/2008/digital_searching/dsearch/boost/dsearch/trie.hpp
==============================================================================
--- sandbox/SOC/2008/digital_searching/dsearch/boost/dsearch/trie.hpp (original)
+++ sandbox/SOC/2008/digital_searching/dsearch/boost/dsearch/trie.hpp 2008-06-06 13:45:47 EDT (Fri, 06 Jun 2008)
@@ -46,6 +46,8 @@
         typedef trie_cursor<key_type,data_type,node_type> cursor;
         typedef trie_iterator<key_type,data_type,cursor> iterator;
         typedef trie_iterator<key_type,const data_type,cursor> const_iterator;
+ typedef trie_reverse_iterator<key_type,data_type,cursor> reverse_iterator;
+ typedef trie_reverse_iterator<key_type,data_type,cursor> const_reverse_iterator;
 
         trie()
         {
@@ -82,7 +84,7 @@
 
         std::size_t size()
         {
- return 0; //for now
+ return 0;
         }
 
         std::size_t max_size()
@@ -155,7 +157,7 @@
         }
 
         //make use of iterator iterator.push();
- iterator find(const key_type &key) const //make this iterator instead of bool;
+ iterator find(const key_type &key)//make this iterator instead of bool;
         {
                 typename Key_traits::const_iterator it=Key_traits::begin(key),
                                         end_it=Key_traits::end(key);
@@ -166,7 +168,8 @@
                 {
                         ret_it.push(cur);
                         next=cur.find(*it);
- if ( next == cur.end() ) return end();
+ if ( next == cur.end() )
+ return end();
                         cur=next;
                         it++;
                 }
@@ -396,21 +399,51 @@
                 iter.top().get_node()->erase(node_it);
         }
 
+ void erase(iterator first, iterator second)
+ {
+ while(first!=second)
+ {
+ erase(first);
+ ++first;
+ }
+ }
+
         void swap(type &other)
         {
                 std::swap(other.node_root,node_root);
         }
 
- iterator begin() const
+ iterator begin()
         {
                 return iterator(root(),false);
         }
+
+ const_iterator begin() const
+ {
+ return const_iterator(root(),false);
+ }
 
- iterator end() const
+
+ iterator end()
         {
                 return iterator(root(),true);
         }
 
+ const_iterator end() const
+ {
+ return const_iterator(root(),true);
+ }
+
+ reverse_iterator rbegin() const
+ {
+ return reverse_iterator(begin(),end(),true);
+ }
+
+ reverse_iterator rend() const
+ {
+ return reverse_iterator(begin(),end(),false);
+ }
+
         cursor root() const
         {
                 return cursor(node_root);
@@ -423,7 +456,7 @@
                 node_allocator.deallocate(node_root,1);
         }
         private:
-
+
         //get reference to the leaf node of the key
         node_type *insert_(const key_type &key)
         {


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