On 7/4/07, Joaquin M Lopez Munoz
Hello Tony,
Gottlob Frege
writes: On 6/29/07, Felipe Magno de Almeida
wrote: Use equal_range. It returns a pair of iterators to begin and end of the equal range.
Similar question - once I have the equal_range, how do I iterate through them via a different index?
ie ordered_non_unique
+ ordered_unique how do I display a list of the items sorted by category, then by item name within each category?
If what you want to do is traverse a range obtained from index #n following the order imposed by index #m, then you can't do that efficiently, sorry. However, the particular case you're posing does not boil down to that, but to something different: ordering elements by lexicographical order according to two keys, here category and ItenName. You can do this by making the category use a composite key on category+itenname.
Not sure whether this is what you're after. Does it help?
Yeah that works, and is pretty much what I already have (without multi_index) but I was hoping that it would be one more problem solved with multi_index. (In my case, I still have other reasons for multi_index - there are actually more keys than just the 2 I used in the example.) Thanks - at least I know I'm not missing something! Tony