|
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 @@
map.find(
static_cast<final_node_type*>(
node_type::from_impl(next_org))))->impl();
+ cpy->next()->prev()=cpy;
next_org=next_org->next();
cpy=cpy->next();
}
cpy->next()=begin_cpy;
+ begin_cpy->prev()=cpy;
}
super::copy_(x,map);
@@ -938,7 +940,12 @@
}
else{
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 acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk