Boost logo

Boost :

Subject: Re: [boost] [multi-index] Changing hash_index_node.hpp to doublelinked list
From: joaquin_at_[hidden]
Date: 2009-04-29 05:09:43

brad higgins escribió:
> Hi Joaquín,
> Thanks for the quick response. I have attached
> the files I edited.
> Thank you very much for the help,
> Brad

Hi Brad,

There were one more change to do in boost/multi_index/hashed_index.hpp,
please find attached a .diff file. I also updated the invariant_()
member function
to check the new doubly linked internal structure.

Moreover, your modified hashed_index retains forward iterators from the
original, but I guess you can trivially implement them as bidirectional
(clue: see
how this is done at sequenced_index.hpp).

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo

Index: hashed_index.hpp
--- hashed_index.hpp (revision 52074)
+++ hashed_index.hpp (working copy)
@@ -679,10 +679,12 @@
+ cpy->next()->prev()=cpy;
+ begin_cpy->prev()=cpy;
@@ -938,7 +940,12 @@
       size_type s0=0;
- for(const_iterator it=begin(),it_end=end();it!=it_end;++it,++s0){}
+ for(const_iterator it=begin(),it_end=end();it!=it_end;++it,++s0){
+ if(it.get_node()->impl()->next()->prev()!=it.get_node()->impl())
+ return false;
+ if(it.get_node()->impl()->prev()->next()!=it.get_node()->impl())
+ return false;
+ }
       if(s0!=size())return false;
       size_type s1=0;

Boost list run by bdawes at, gregod at, cpdaniel at, john at