C++'s unordered_map / hash_map / Google's dense_hash - how to input binary data (buf+len) and insert
- by shlomif
Hi all,
I have two questions about Google's dense_hash_map, which can be used instead of the more standard unordered_map or hash_map:
How do I use an arbitrary binary data memory segment as a key: I want a buffer+length pair, which may still contain some NUL (\0) characters. I can see how I use a NUL-terminated char * string , but that's not what I want.
How do I implement an operation where I look if a key exists, and if not - insert it and if it does return the pointer to the existing key and let me know what actually happened.
I'd appreciate it if anyone can shed any light on this subject.
Regards,
-- Shlomi Fish