Skip to main content
gamedev.net
🔒 Locked

hash_map suitable ?

Started by FearedPixel 1 reply 550+ views
Original Post
FearedPixel
FearedPixel
I need to create a string->string association in my program where the first string (the key) is small (few characters), but the second string (the element) can be fairly large (several kilobytes). Is a hash_map suitable for a situation like this? Or could it be a problem for the hash function or something that the data is so big? or does the size of the data not really affect the access or the hashing?
civguy
civguy
Size of the data doesn't matter. hash_map sounds like a proper choice for you. But keep in mind that when adding stuff to the hash_map or when hash_map does resizing, there'll be lots of copying of the data. I'd suggest you dynamically allocate the data with new and store it to the map as a pointer.

[edited by - civguy on March 23, 2003 3:46:12 PM]
FearedPixel
FearedPixel
Ah, thanks.

Thats ok, since I will not be adding or removing from it frequently, and even when I am it will not be time critical. It will just be getting access frequently, and that access has to be fast.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.