By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,158 Members | 1,004 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,158 IT Pros & Developers. It's quick & easy.

Need help with a dictionary class...

P: n/a
I have a dictionary that looks like:

a0,b0,c0,d0,e0
a1,b1,c1,d1,e1
....
....

Currently I consider [a,b] (Class Tag) to be the key and [c,d,e]
(Class Value) to be the value.
However I now need to use [e] as the key and [a,b,c,d] as the value.

the dictionary class uses defines:
std::map<Tag, Valuedictionary;
as the dictionary... (Where Tag and Values are classes)

What must I do to be able to have more than one key?
Must I define two new classes for TagB and ValuesB and another
dictionary based on these classes?
Multimaps seems to pop into mind.. but I don't know how to use the and
am not sure if they are part of the stl...

Jun 7 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
SpreadTooThin wrote:
I have a dictionary that looks like:

a0,b0,c0,d0,e0
a1,b1,c1,d1,e1
...
...

Currently I consider [a,b] (Class Tag) to be the key and [c,d,e]
(Class Value) to be the value.
IOW, you have an associative array:

K0 : V0
K1 : V1
...

where Kx is a list and Vx is a list?
However I now need to use [e] as the key and [a,b,c,d] as the value.
I.e.

Kk0 : Vv0
...

(same scheme), and Kkx and Vvx are also lists, right?
>
the dictionary class uses defines:
std::map<Tag, Valuedictionary;
as the dictionary... (Where Tag and Values are classes)

What must I do to be able to have more than one key?
Probably, more than one dictionary...
Must I define two new classes for TagB and ValuesB and another
dictionary based on these classes?
Probably.
Multimaps seems to pop into mind.. but I don't know how to use the and
am not sure if they are part of the stl...
There is 'std::multimap', but it is like a 'map' with mutliple keys
allowed. I don't see how it's applicable here.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jun 7 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.