std::pair usage in google sparse hash

9 views
Skip to first unread message

Shankar

unread,
Sep 11, 2009, 5:34:31 PM9/11/09
to google-sparsehash
The key value pair is constructed in the google sparse hash map by
using std::pair. The std::pair has an inherent problem that the
key,value pair is not packed.

For example

If I define a key value pair, google::sparse_hash_map<uint64_t,
uint32_t>, the hash is going to consume 16 bytes instead of 12 bytes.

Is there an alternative implementation which doesnot use std::pair ?

-

Shankar Easwaran

Craig Silverstein

unread,
Sep 11, 2009, 5:38:13 PM9/11/09
to google-s...@googlegroups.com
} Is there an alternative implementation which doesnot use std::pair ?

There is not. However, sparse_hash_map is a pretty thin wrapper
around sparsehashtable. You could write your own wrapper around
sparsehashtable with not that much code, and replace pair<> with the
data structure of your choice. I don't think you'll need to modify
the sparsehashtable code at all.

craig

Reply all
Reply to author
Forward
0 new messages