
----- Mensaje original -----
De: Hubert Schmid
Hi,
I guess there is a bug in boost/multi_index/sequenced_index.hpp. The following program fails to compile, because there is no matching operator== for class C. But this operator shouldn't be required for splice. [...] The following program compiles, but both assertions fail at runtime: [...] I have made both tests with the boost library in Debian/unstable (version 1.33.1-7). I have also compared the source file sequenced_index.hpp with the CVS-MAIN version (1.12). I guess the following patch should fix this bug:
--- sequenced_index.hpp.orig 2006-09-29 11:38:06.000000000 +0200 +++ sequenced_index.hpp 2006-09-29 11:39:43.000000000 +0200 @@ -355,7 +355,7 @@ BOOST_MULTI_INDEX_CHECK_DEREFERENCEABLE_ITERATOR(i); BOOST_MULTI_INDEX_CHECK_IS_OWNER(i,x); BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT; - if(x==*this){ + if(&x==this){ if(position!=i)relink(position.get_node(),i.get_node()); } else{ @@ -388,7 +388,7 @@ BOOST_MULTI_INDEX_CHECK_IS_OWNER(last,x); BOOST_MULTI_INDEX_CHECK_VALID_RANGE(first,last); BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT; - if(x==*this){ + if(&x==this){ BOOST_MULTI_INDEX_CHECK_OUTSIDE_RANGE(position,first,last); if(position!=last)relink( position.get_node(),first.get_node(),last.get_node());
Hello Hubert, This is indeed a bug, and a gross one I must embarrassingly admit :) Also, the proposed patch is the way to go. Thank you very much for spotting this, I'll be committing the fixes next Monday (during weekends I'm CVS-disabled.) FYI, the same probem also shows at other places like random-access indices and some other ops like merge, yet the reference docs use the correct expression &x==this everywhere, it's so disturbing, I wonder how this could go unnoticed for so long. Best regards, Joaquín M López Muñoz Telefónica, Investigación y Desarrollo