|
Boost Users : |
From: Gottlob Frege (gottlobfrege_at_[hidden])
Date: 2007-07-04 17:54:00
On 7/4/07, Joaquin M Lopez Munoz <joaquin_at_[hidden]> wrote:
> Hello Tony,
>
> Gottlob Frege <gottlobfrege <at> gmail.com> writes:
>
> >
> > On 6/29/07, Felipe Magno de Almeida <felipe.m.almeida <at> gmail.com> 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<category...> + ordered_unique<ItemName...>
> >
> > 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
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net