
----- Mensaje original ----- De: Elisha Berns <e.berns@computer.org> Fecha: Sábado, Julio 16, 2005 3:15 am Asunto: Re: [Boost-users] Container/Algorithm question
Joaquin,
Sorry to be the bearer of bad news, but for some reason the multi- indexcontainer starts to fail for some larger number of pairs (a few hundred). The container doesn't/won't insert them, and to be honest, I don't have a clue at this point why.
The code is so simple that I fail to see how it can be failing, so let's insert some traces: std::pair<iterator,bool> insert(const value_type& x) { iterator it0=impl.find(boost::make_tuple(x.first)); if(it0!=impl.end()){ typename impl_type::nth_index_iterator<1>::type it1= impl.template get<1>().find(x.second); if(it1!=impl.template get<1>().end()){ std::cout<<x.first<<","<<x.second<<std::endl; std::cout<<it0->first<<","<<it0->second<<std::endl; std::cout<<it1->first<<","<<it1->second<<std::endl; return std::make_pair(it0,false); } } return impl.insert(x); } Can you insert the std::cout output sentences above to your code and report what it's showing? If everything is working OK, when an insertion fails, x.first==it0->first and x.second=it1->second. Isn't it so? Can you provide the data the container is fed with when the first (erroneous) insertion failure happens?
If you're up for it you might want to stress test the code you sent me with thousands of unique pairs and redundant pairs.
I'll examine this closer next Monday if we haven't located the problem before. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo