hash_map with multiple integer key

M

MakaMaka

Hi,
I need to define a hash table of some kind that uses a three long
integer keys and returns a long. I'm trying to speed up a
computational python script. What i need to replace looks something
like this:

blah = {}
blah[(1,2,3}] = 4

so blah[(1,2,3)] would return 4.

This has obviously been done (it's in the python interpeter). Does
anyone know how to implement this using the hash_map template of SGI's
stl implementation or something similar?

Thanks,
-Justin
 
M

mlimber

MakaMaka said:
Hi,
I need to define a hash table of some kind that uses a three long
integer keys and returns a long. I'm trying to speed up a
computational python script. What i need to replace looks something
like this:

blah = {}
blah[(1,2,3}] = 4

so blah[(1,2,3)] would return 4.

This has obviously been done (it's in the python interpeter). Does
anyone know how to implement this using the hash_map template of SGI's
stl implementation or something similar?

Thanks,
-Justin

Why not just use a std::map with a data structure containing your three
keys (you could roll your own or use two std::pair's or boost::tuple).

Cheers! --M
 

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
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top