Need help with a dictionary class...

S

SpreadTooThin

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, Value> dictionary;
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...
 
V

Victor Bazarov

SpreadTooThin said:
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, Value> dictionary;
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,954
Messages
2,570,116
Members
46,704
Latest member
BernadineF

Latest Threads

Top