Re: key / value lookup
From: Tom Widmer (tom_usenet_at_hotmail.com)
Date: 10/13/04
- Next message: Priyesh: "Re: key / value lookup"
- Previous message: Stephen Howe: "Re: key / value lookup"
- In reply to: Priyesh: "key / value lookup"
- Next in thread: Priyesh: "Re: key / value lookup"
- Reply: Priyesh: "Re: key / value lookup"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 13 Oct 2004 18:21:44 +0100
On Wed, 13 Oct 2004 09:01:32 -0700, "Priyesh"
<PriyeshPadmavilasom@cougarmtn.com> wrote:
>I need lookups from values to keys in a map. I end up creating a second map
>with keys as the first map's values. Is there an easy way to deal with this
>situation?
Yes, use the multi-indexing container library from:
http://www.jobmanager.com/engineering/boost/nightly/
It will be included in the next official boost (www.boost.org)
release. You might be able to find a downloadable zip of just that
library somewhere.
>For eg:
>I have <column type> to <column index> map as an map<int, int> ( used to
>find the type of a column from it's displayed index)
>
>I come across situations where i need to find the column type of a column
>index, so i end up creating a second map for this purpose as <column index>
>to <column type>.
If you don't need to do that look-up often, you could just use
std::find_if with a suitable predicate to compare against the value.
Tom
- Next message: Priyesh: "Re: key / value lookup"
- Previous message: Stephen Howe: "Re: key / value lookup"
- In reply to: Priyesh: "key / value lookup"
- Next in thread: Priyesh: "Re: key / value lookup"
- Reply: Priyesh: "Re: key / value lookup"
- Messages sorted by: [ date ] [ thread ]