JOAQUIN LOPEZ MU?Z wrote:
So far so good. When saving and subsequently loading this container, Boost.MultiIndex guarantees that the traversal order of *every* index is preserved. Now, suppose serialization were implemented the naive way, that is, by just saving the elements as they are visited by the first index and loading through the first index again, just as you're doing in your workaround (no offense meant by the use of the word "naive", of course.) If you examine the process carefully, you can see that, when performed this way, index #0 is correctly replicated, but the resulting order of the loaded index #1 is
(0,1,0), (1,1,1), (2,1,2)
which does not match the original. This is why Boost.MultiIndex saves, additionally to the elements, enough extra information to restore index traversal orders in those cases where such order is not univocally determined (ordered non-unique, sequenced and random-access indices.) And when applying this extra information, the kind of sanity check you've been bitten by is routinely performed. I hope I've made myself clear, sorry for the long explanation.
Thanks for the very clear explanation. "Bitten by" is a kind way of saying "corrected by"! John.