*** original_list.h	2011-05-29 19:23:14.565730701 -0300
--- list.h	2011-05-29 19:21:33.801125236 -0300
***************
*** 1,11 ****
  // EPOS List Utility Declarations
  
  #ifndef __list_h
! #define        __list_h
  
! #include <system/config.h>
  
- __BEGIN_SYS
  
  // List Element Rank (for ordered lists)
  class List_Element_Rank
--- 1,10 ----
  // EPOS List Utility Declarations
  
  #ifndef __list_h
! #define __list_h
  
! #include "../../maybe.h"
  
  
  // List Element Rank (for ordered lists)
  class List_Element_Rank
***************
*** 370,377 ****
      bool empty() const { return (_size == 0); }
      unsigned int size() const { return _size; }
  
!     Element * head() { return _head; }
!     Element * tail() { return _tail; }
  
      Iterator begin() { return Iterator(_head); }
      Iterator end() { return Iterator(_tail->next()); }
--- 369,376 ----
      bool empty() const { return (_size == 0); }
      unsigned int size() const { return _size; }
  
!     Maybe<Element*> head() { return Maybe<Element*>(_head, _head != 0); }
!     Maybe<Element*> tail() { return Maybe<Element*>(_tail, _tail != 0); }
  
      Iterator begin() { return Iterator(_head); }
      Iterator end() { return Iterator(_tail->next()); }
***************
*** 399,407 ****
          }
      }
      
!     Element * remove() { return remove_head(); }
  
!     Element * remove(Element * e) {
          if(last())
              remove_last();
          else if(e == _head)
--- 398,406 ----
          }
      }
      
!     Maybe<Element*> remove() { return remove_head(); }
  
!     Element* remove(Element * e) {
          if(last())
              remove_last();
          else if(e == _head)
***************
*** 418,450 ****
          return e;
      }
  
!     Element * remove_head() {
          if(empty())
!             return 0;
          if(last())
!             return remove_last();
!         Element * e = _head;
          _head = _head->next();
          _size--;
          return e;
      }
  
!     Element * remove_tail() {
!         if(_tail)
!                 return remove(_tail);
      }
  
!     Element * remove(const Object_Type * obj) {
!         Element * e = search(obj);
!         if(e)
!             return remove(e);
!         return 0;
      }
      
!     Element * search(const Object_Type * obj) {
          Element * e = _head;
!             for(; e && (e->object() != obj); e = e->next());
!             return e;
      }
      
  protected:
--- 417,453 ----
          return e;
      }
  
!     Maybe<Element*> remove_head() {
          if(empty())
!             return Maybe<Element*>();
          if(last())
!             return Maybe<Element*>(remove_last());
!         Element * e = Maybe<Element*>(_head);
          _head = _head->next();
          _size--;
          return e;
      }
  
!     Maybe<Element*> remove_tail() {
!         Maybe<Element*> e;
! 
!         if(_tail != 0)
!             e = Maybe<Element*>(remove(_tail));
! 
!         return e;
      }
  
!     Maybe<Element*> remove(const Object_Type * obj) {
!         Maybe<Element*> e = search(obj);
!         if(e.exists())
!             return Maybe<Element*>(remove(e.get()));
!         return Maybe<Element*>();
      }
      
!     Maybe<Element*> search(const Object_Type * obj) {
          Element * e = _head;
!         for(; e && (e->object() != obj); e = e->next());
!         return Maybe<Element*>(e, e != 0);
      }
      
  protected:
***************
*** 507,513 ****
              insert_first(e);
          else {
              Element * next, * prev;
!             for(next = head(), prev = 0;
                  (next->rank() <= e->rank()) && next->next();
                  prev = next, next = next->next())
                  if(relative)
--- 510,516 ----
              insert_first(e);
          else {
              Element * next, * prev;
!             for(next = head().get(), prev = 0;
                  (next->rank() <= e->rank()) && next->next();
                  prev = next, next = next->next())
                  if(relative)
***************
*** 528,534 ****
          }
      }
      
!     Element * remove() { return remove_head(); }
  
      Element * remove(Element * e) {
          Base::remove(e);
--- 531,537 ----
          }
      }
      
!     Maybe<Element*> remove() { return remove_head(); }
  
      Element * remove(Element * e) {
          Base::remove(e);
***************
*** 537,560 ****
          return e;
      }
  
!     Element * remove(const Object_Type * obj) {
!         Element * e = search(obj);
!         if(e)
!             return remove(e);
!         return 0;
      }
      
!     Element * search_rank(int rank) {
!         Element * e = head();
!         for(; e && (e->rank() != rank); e = e->next());
!         return e;
      }
  
!     Element * remove_rank(int rank) {
!         Element * e = search_rank(rank);
!         if(e)
!             return remove(e);
!         return 0;
      }
  };
  
--- 540,568 ----
          return e;
      }
  
!     Maybe<Element*> remove(const Object_Type * obj) {
!         Maybe<Element*> e = search(obj);
!         if(e.exists())
!             return Maybe<Element*>(remove(e.get()));
!         return Maybe<Element*>();
      }
      
!     Maybe<Element*> search_rank(int rank) {
!         Maybe<Element*> el = head();
!         if(el.exists()) {
!             Element* e(el.get());
!             for(; e && (e->rank() != rank); e = e->next());
!             return Maybe<Element*>(e, e != 0);
!         }
! 
!         return Maybe<Element*>();
      }
  
!     Maybe<Element*> remove_rank(int rank) {
!         Maybe<Element*> e(search_rank(rank));
!         if(e.exists())
!             return Maybe<Element*>(remove(e.get()));
!         return Maybe<Element*>();
      }
  };
  
***************
*** 591,606 ****
  
      unsigned int grouped_size() const { return _grouped_size; }
  
!     Element * search_size(unsigned int s) {
!         Element * e = head();
!         for(; e && (e->size() < s); e = e->next());
!         return e;
      }
      
!     Element * search_left(const Object_Type * obj) {
!         Element * e = head();
!         for(; e && (e->object() + e->size() != obj); e = e->next());
!         return e;
      }
      
      void insert_merging(Element * e, Element ** m1, Element ** m2) {
--- 599,622 ----
  
      unsigned int grouped_size() const { return _grouped_size; }
  
!     Maybe<Element*> search_size(unsigned int s) {
!         Maybe<Element*> el = head();
!         if(el.exists()) {
!             Element* e = el.get();
!             for(; e && (e->size() < s); e = e->next());
!             return e;
!         }
!         return Maybe<Element*>();
      }
      
!     Maybe<Element*> search_left(const Object_Type * obj) {
!         Maybe<Element*> el = head();
!         if(el.exists()) {
!             Element* e = el.get();
!             for(; e && (e->object() + e->size() != obj); e = e->next());
!             return e;
!         }
!         return Maybe<Element*>();
      }
      
      void insert_merging(Element * e, Element ** m1, Element ** m2) {
***************
*** 620,634 ****
              insert_tail(e);
      }
      
!     Element * search_decrementing(unsigned int s) {
!         Element * e = search_size(s);
!         if(e) {
              e->shrink(s);
              _grouped_size -= s;
              if(!e->size())
                  remove(e);
          }
!         return e;
      }
      
  private:
--- 636,651 ----
              insert_tail(e);
      }
      
!     Maybe<Element*> search_decrementing(unsigned int s) {
!         Maybe<Element*> el = search_size(s);
!         if(el.exists()) {
!             Element* e = el.get();
              e->shrink(s);
              _grouped_size -= s;
              if(!e->size())
                  remove(e);
          }
!         return el;
      }
      
  private:
***************
*** 652,659 ****
      bool empty() const { return (_size == 0); }
      unsigned int size() const { return _size; }
      
!     Element * head() { return _head; }
!     Element * tail() { return _tail; }
      
      Iterator begin() { return Iterator(_head); }
      Iterator end() { return Iterator(_tail->next()); }
--- 669,676 ----
      bool empty() const { return (_size == 0); }
      unsigned int size() const { return _size; }
      
!     Maybe<Element*> head() { return Maybe<Element*>(_head, _head != 0); }
!     Maybe<Element*> tail() { return Maybe<Element*>(_tail, _tail != 0); }
      
      Iterator begin() { return Iterator(_head); }
      Iterator end() { return Iterator(_tail->next()); }
***************
*** 661,675 ****
      void insert(Element * e) { insert_tail(e); }
  
      void insert_head(Element * e) {
-         db<Lists>(TRC) << "List::insert_head(e=" << e 
-                       << ") => {p=" << (e ? e->prev() : (void *) -1)
-                       << ",o=" << (e ? e->object() : (void *) -1)
-                       << ",n=" << (e ? e->next() : (void *) -1)
-                       << "}\n";
- 
-         print_head();
-         print_tail();
- 
          if(empty())
              insert_first(e);
          else {
--- 678,683 ----
***************
*** 679,699 ****
              _head = e;
              _size++;
          }
- 
-         print_head();
-         print_tail();
      }
  
      void insert_tail(Element * e) {
-         db<Lists>(TRC) << "List::insert_tail(e=" << e 
-                       << ") => {p=" << (e ? e->prev() : (void *) -1)
-                       << ",o=" << (e ? e->object() : (void *) -1)
-                       << ",n=" << (e ? e->next() : (void *) -1)
-                       << "}\n";
- 
-         print_head();
-         print_tail();
- 
          if(empty())
              insert_first(e);
          else {
--- 687,695 ----
***************
*** 703,725 ****
              _tail = e;
              _size++;
          }
- 
-         print_head();
-         print_tail();
      }
      
!     Element * remove() { return remove_head(); }
  
      Element * remove(Element * e) {
-         db<Lists>(TRC) << "List::remove(e=" << e 
-                       << ") => {p=" << (e ? e->prev() : (void *) -1)
-                       << ",o=" << (e ? e->object() : (void *) -1)
-                       << ",n=" << (e ? e->next() : (void *) -1)
-                       << "}\n";
- 
-         print_head();
-         print_tail();
- 
          if(last())
              remove_last();
          else if(!e->prev())
--- 699,709 ----
              _tail = e;
              _size++;
          }
      }
      
!     Maybe<Element*> remove() { return remove_head(); }
  
      Element * remove(Element * e) {
          if(last())
              remove_last();
          else if(!e->prev())
***************
*** 731,751 ****
              e->next()->prev(e->prev());
              _size--;
          }
- 
-         print_head();
-         print_tail();
- 
          return e;
      }
  
!     Element * remove_head() {
!         db<Lists>(TRC) << "List::remove_head()\n";
! 
!         print_head();
!         print_tail();
! 
          if(empty())
!             return 0;
          if(last())
              return remove_last();
          Element * e = _head;
--- 715,726 ----
              e->next()->prev(e->prev());
              _size--;
          }
          return e;
      }
  
!     Maybe<Element*> remove_head() {
          if(empty())
!             return Maybe<Element*>();
          if(last())
              return remove_last();
          Element * e = _head;
***************
*** 753,772 ****
          _head->prev(0);
          _size--;
  
!         print_head();
!         print_tail();
! 
!         return e;
      }
  
!     Element * remove_tail() {
!         db<Lists>(TRC) << "List::remove_tail()\n";
! 
!         print_head();
!         print_tail();
! 
          if(empty())
!             return 0;
          if(last())
              return remove_last();
          Element * e = _tail;
--- 728,739 ----
          _head->prev(0);
          _size--;
  
!         return Maybe<Element*>(e);
      }
  
!     Maybe<Element*> remove_tail() {
          if(empty())
!             return Maybe<Element*>();
          if(last())
              return remove_last();
          Element * e = _tail;
***************
*** 774,880 ****
          _tail->next(0);
          _size--;
  
!         print_head();
!         print_tail();
! 
!         return e;
      }
  
!     Element * remove(const Object_Type * obj) {
!         Element * e = search(obj);
!         if(e)
!             return remove(e);
!         return 0;
      }
      
!     Element * search(const Object_Type * obj) {
          Element * e = _head;
          for(; e && (e->object() != obj); e = e->next());
!         return e;
      }
      
  protected:
      bool last() const { return (_size == 1); }
  
      void insert(Element * e, Element * p,  Element * n) {
-         db<Lists>(TRC) << "List::insert(e=" << e << ",p=" << p << ",n=" << n
-                       << ") => {p=" << (e ? e->prev() : (void *) -1)
-                       << ",o=" << (e ? e->object() : (void *) -1)
-                       << ",n=" << (e ? e->next() : (void *) -1)
-                       << "},{p=" << (p ? p->prev() : (void *) -1)
-                       << ",o=" << (p ? p->object() : (void *) -1)
-                       << ",n=" << (p ? p->next() : (void *) -1)
-                       << "},{p=" << (n ? n->prev() : (void *) -1)
-                       << ",o=" << (n ? n->object() : (void *) -1)
-                       << ",n=" << (n ? n->next() : (void *) -1)
-                       << "}\n";
- 
-         print_head();
-         print_tail();
- 
          p->next(e);
          n->prev(e);
          e->prev(p);
          e->next(n);
          _size++;
- 
-         print_head();
-         print_tail();
      }
  
      void insert_first(Element * e) {
-         db<Lists>(TRC) << "List::insert_first(e=" << e 
-                       << ") => {p=" << (e ? e->prev() : (void *) -1)
-                       << ",o=" << (e ? e->object() : (void *) -1)
-                       << ",n=" << (e ? e->next() : (void *) -1)
-                       << "}\n";
- 
-         print_head();
-         print_tail();
- 
          e->prev(0);
          e->next(0);
          _head = e;
          _tail = e;
          _size++;
- 
-         print_head();
-         print_tail();
      }
  
!     Element * remove_last() {
!         db<Lists>(TRC) << "List::remove_last()\n";
! 
!         print_head();
!         print_tail();
! 
!         Element * e = _head;
          _head = 0;
          _tail = 0;
          _size--;
  
-         print_head();
-         print_tail();
- 
          return e;
      }
  
-     void print_head() {
-         db<Lists>(INF) << "List[" << this << "]::head=" << head() 
-                       << " => {p=" << (head() ? head()->prev() : (void *) -1)
-                       << ",o=" << (head() ? head()->object() : (void *) -1)
-                       << ",n=" << (head() ? head()->next() : (void *) -1)
-                       << "}\n";
-     }
- 
-     void print_tail() {
-         db<Lists>(INF) << "List[" << this << "]::tail=" << tail() 
-                        << " => {p=" << (tail() ? tail()->prev() : (void *) -1)
-                        << ",o=" << (tail() ? tail()->object() : (void *) -1)
-                        << ",n=" << (tail() ? tail()->next() : (void *) -1)
-                        << "}\n";
-     }
- 
  private:
      unsigned int _size;
      Element * _head;
--- 741,790 ----
          _tail->next(0);
          _size--;
  
!         return Maybe<Element*>(e);
      }
  
!     Maybe<Element*> remove(const Object_Type * obj) {
!         Maybe<Element*> e(search(obj));
!         if(e.exists())
!             return Maybe<Element*>(remove(e.get()));
!         return Maybe<Element*>();
      }
      
!     Maybe<Element*> search(const Object_Type * obj) {
          Element * e = _head;
          for(; e && (e->object() != obj); e = e->next());
!         return Maybe<Element*>(e, e != 0);
      }
      
  protected:
      bool last() const { return (_size == 1); }
  
      void insert(Element * e, Element * p,  Element * n) {
          p->next(e);
          n->prev(e);
          e->prev(p);
          e->next(n);
          _size++;
      }
  
      void insert_first(Element * e) {
          e->prev(0);
          e->next(0);
          _head = e;
          _tail = e;
          _size++;
      }
  
!     Maybe<Element*> remove_last() {
!         Maybe<Element*> e = head();
          _head = 0;
          _tail = 0;
          _size--;
  
          return e;
      }
  
  private:
      unsigned int _size;
      Element * _head;
***************
*** 907,923 ****
      using Base::end;
  
      void insert(Element * e) {
-         db<Lists>(TRC) << "Ordered_List::insert(e=" << e 
-                       << ") => {p=" << (e ? e->prev() : (void *) -1)
-                       << ",o=" << (e ? e->object() : (void *) -1)
-                       << ",n=" << (e ? e->next() : (void *) -1)
-                       << "}\n";
- 
          if(empty())
              insert_first(e);
          else {
              Element * next;
!             for(next = head();
                  (next->rank() <= e->rank()) && next->next();
                  next = next->next())
                  if(relative)
--- 817,827 ----
      using Base::end;
  
      void insert(Element * e) {
          if(empty())
              insert_first(e);
          else {
              Element * next;
!             for(next = head().get();
                  (next->rank() <= e->rank()) && next->next();
                  next = next->next())
                  if(relative)
***************
*** 938,956 ****
          }
      }
      
!     Element * remove() { 
!         db<Lists>(TRC) << "Ordered_List::remove()\n";
! 
          return Base::remove_head();
      }
  
!     Element * remove(Element * e) {
!         db<Lists>(TRC) << "Ordered_List::remove(e=" << e 
!                       << ") => {p=" << (e ? e->prev() : (void *) -1)
!                       << ",o=" << (e ? e->object() : (void *) -1)
!                       << ",n=" << (e ? e->next() : (void *) -1)
!                       << "}\n";
! 
          Base::remove(e);
          if(relative && e->next())
              e->next()->rank(e->next()->rank() + e->rank());
--- 842,852 ----
          }
      }
      
!     Maybe<Element*> remove() { 
          return Base::remove_head();
      }
  
!     Element* remove(Element * e) {
          Base::remove(e);
          if(relative && e->next())
              e->next()->rank(e->next()->rank() + e->rank());
***************
*** 958,985 ****
          return e;
      }
  
!     Element * remove(const Object_Type * obj) {
!         db<Lists>(TRC) << "Ordered_List::remove(o=" << obj << ")\n";
! 
!         Element * e = search(obj);
!         if(e)
!             return remove(e);
!         return 0;
      }
      
      Element * search_rank(int rank) {
!         Element * e = head();
!         for(; e && (e->rank() != rank); e = e->next());
!         return e;
      }
  
      Element * remove_rank(int rank) {
!         db<Lists>(TRC) << "Ordered_List::remove_rank(r=" << rank << ")\n";
! 
!         Element * e = search_rank(rank);
!         if(e)
!             return remove(e);
!         return 0;
      }
  };
  
--- 854,881 ----
          return e;
      }
  
!     Maybe<Element*> remove(const Object_Type * obj) {
!         Maybe<Element*> e = search(obj);
!         if(e.exists())
!             return Maybe<Element*>(remove(e.get()));
!         return Maybe<Element*>();
      }
      
      Element * search_rank(int rank) {
!         Maybe<Element*> el = head();
!         if(el.exists()) {
!             Element* e(el.get());
!             for(; e && (e->rank() != rank); e = e->next());
!             return Maybe<Element*>(e, e != 0);
!         }
!         return Maybe<Element*>();
      }
  
      Element * remove_rank(int rank) {
!         Maybe<Element*> e = search_rank(rank);
!         if(e.exists())
!             return Maybe<Element*>(remove(e.get()));
!         return Maybe<Element*>();
      }
  };
  
***************
*** 1016,1042 ****
      using Base::begin;
      using Base::end;
  
!     Element * volatile & chosen() { return _chosen; }
  
      void insert(Element * e) {
-         db<Lists>(TRC) << "Scheduling_List::insert(e=" << e 
-                       << ") => {p=" << (e ? e->prev() : (void *) -1)
-                       << ",o=" << (e ? e->object() : (void *) -1)
-                       << ",n=" << (e ? e->next() : (void *) -1)
-                       << "}\n";
- 
          Base::insert(e);
            if(!_chosen)
               _chosen = head();
      }
  
      Element * remove(Element * e) {
-         db<Lists>(TRC) << "Scheduling_List::remove(e=" << e 
-                       << ") => {p=" << (e ? e->prev() : (void *) -1)
-                       << ",o=" << (e ? e->object() : (void *) -1)
-                       << ",n=" << (e ? e->next() : (void *) -1)
-                       << "}\n";
- 
          Base::remove(e);
          if(e == _chosen)
              _chosen = head();
--- 912,926 ----
      using Base::begin;
      using Base::end;
  
!     Maybe<Element*> volatile & chosen() { return Maybe<Element*>(_chosen, _chosen != 0); }
  
      void insert(Element * e) {
          Base::insert(e);
            if(!_chosen)
               _chosen = head();
      }
  
      Element * remove(Element * e) {
          Base::remove(e);
          if(e == _chosen)
              _chosen = head();
***************
*** 1044,1088 ****
          return e;
      }
  
!     Element * remove(const Object_Type * obj) {
!         Element * e = search(obj);
!         if(e)
!             return remove(e);
          else
!             return 0;
      }
  
!     Element * choose() {
!         db<Lists>(TRC) << "Scheduling_List::choose()\n";
! 
          if(!empty()) {
              reorder();
!             _chosen = head();
          }
  
!         return _chosen;
      }
  
!     Element * choose_another() {
!         db<Lists>(TRC) << "Scheduling_List::choose_another()\n";
! 
          if(size() > 1) {
              Element * tmp = _chosen;
              Base::remove(tmp);
!             _chosen = Base::head();
              Base::insert(tmp);
          }
  
!         return _chosen;
      }
  
      Element * choose(Element * e) {
-         db<Lists>(TRC) << "Scheduling_List::choose(e=" << e 
-                       << ") => {p=" << (e ? e->prev() : (void *) -1)
-                       << ",o=" << (e ? e->object() : (void *) -1)
-                       << ",n=" << (e ? e->next() : (void *) -1)
-                       << "}\n";
- 
          if(_chosen)
              reorder();
          _chosen = e;
--- 928,962 ----
          return e;
      }
  
!     Maybe<Element*> remove(const Object_Type * obj) {
!         Maybe<Element*> e = search(obj);
!         if(e.exists())
!             return Maybe<Element*>(remove(e.get()));
          else
!             return Maybe<Element*>();
      }
  
!     Maybe<Element*> choose() {
          if(!empty()) {
              reorder();
!             _chosen = head().get();
          }
  
!         return Maybe<Element*>(_chosen, _chosen != 0);
      }
  
!     Maybe<Element*> choose_another() {
          if(size() > 1) {
              Element * tmp = _chosen;
              Base::remove(tmp);
!             _chosen = Base::head().get();
              Base::insert(tmp);
          }
  
!         return Maybe<Element*>(_chosen, _chosen != 0);
      }
  
      Element * choose(Element * e) {
          if(_chosen)
              reorder();
          _chosen = e;
***************
*** 1090,1101 ****
          return _chosen;
      }
  
!     Element * choose(const Object_Type * obj) {
!         Element * e = search(obj);
!         if(e)
!             return choose(e);
          else
!             return 0;
      }
  
  private:
--- 964,975 ----
          return _chosen;
      }
  
!     Maybe<Element*> choose(const Object_Type * obj) {
!         Maybe<Element*> e = search(obj);
!         if(e.exists())
!             return Maybe<Element*>(choose(e.get()));
          else
!             return Maybe<Element*>();
      }
  
  private:
***************
*** 1109,1192 ****
      Element * volatile _chosen;
  };
  
- 
- // Doubly-Linked, Grouping List
- template <typename T, 
-           typename El = List_Elements::Doubly_Linked_Grouping<T> >
- class Grouping_List: public List<T, El>
- {
- private:
-     typedef List<T, El> Base;
- 
- public:
-     typedef T Object_Type;
-     typedef El Element;
-     typedef List_Iterators::Bidirecional<El> Iterator;
- 
- public:
-     Grouping_List(): _grouped_size(0) {}
- 
-     using Base::empty;
-     using Base::size;
-     using Base::head;
-     using Base::tail;
-     using Base::begin;
-     using Base::end;
- 
-     unsigned int grouped_size() const { return _grouped_size; }
-     
-     Element * search_size(unsigned int s) {
-         Element * e = head();
-         for(; e && (e->size() < sizeof(Element) + s) && (e->size() != s); e = e->next());
-         return e;
-     }
-     
-     Element * search_left(const Object_Type * obj) {
-         Element * e = head();
-         for(; e && (e->object() + e->size() != obj); e = e->next());
-         return e;
-     }
-     
-     void insert_merging(Element * e, Element ** m1, Element ** m2) {
-         db<Lists>(TRC) << "Grouping_List::insert_merging(e=" << e 
-             << ")    \n";
-         _grouped_size += e->size();
-         *m1 = *m2 = 0;
-         Element * r = search(e->object() + e->size());
-         Element * l = search_left(e->object());
-         if(!l) {
-             insert_tail(e);
-         }
-         if(r) {
-             e->size(e->size() + r->size());
-             remove(r);
-             *m1 = r;
-         }
-         if(l) {
-             l->size(l->size() + e->size());
-             *m2 = e;
-         }
-     }
-     
-     Element * search_decrementing(unsigned int s) {
-         db<Lists>(TRC) << "Grouping_List::search_decrementing(s=" 
-             << s << ")\n";
- 
-         Element * e = search_size(s);
-         if(e) {
-             e->shrink(s);
-             _grouped_size -= s;
-             if(!e->size())
-                 remove(e);
-         }
- 
-         return e;
-     }
-     
- private:
-     unsigned int _grouped_size;
- };
- 
- __END_SYS
   
  #endif
--- 983,987 ----
