About Store Forum Documentation Contact
Donations:
309$/mo



Post Reply 
Hash Maps
Author Message
andargor Offline
Member

Post: #1
Hash Maps
I've been trying to use the Map class, with little success. I get an access violation error. I did look at the tutorial, but it only shows auto-generated data.

I would I insert data in the Map? If I try auto-creation, I get an access violation.

The Map class is odd to use. For example, I don't understand why it would auto-create on a non-existent key. I would expect it to return NULL if the value is not found, otherwise testing against it would create a lot of unnecessary keys.

I think I will go back to stdext::hash_map for now, but it would be great for the future to have a wrapper around it for pointer safety (I can't get hash_map to work with Reference). mapname[key] = data and data = mapname[key] is fun smile

EDIT: Or a Memx-like class, but with arbitrary keys? Str at least...
(This post was last modified: 05-11-2011 02:41 AM by andargor.)
05-11-2011 02:38 AM
Find all posts by this user Quote this message in a reply
Chris Offline
Member

Post: #2
RE: Hash Maps
Map != Hash Map

Headers > Memory > Map.h > find

Quote:
// get
DATA* find (C KEY &key); // find object, don't create if not found, NULL on fail
05-11-2011 10:49 PM
Find all posts by this user Quote this message in a reply
Post Reply