martinus / robin-hood-hashing

Fast & memory efficient hashtable based on robin hood hashing for C++11/14/17/20
https://gitter.im/martinus/robin-hood-hashing
MIT License
1.5k stars 142 forks source link

char* key support #126

Closed KTRosenberg closed 3 years ago

KTRosenberg commented 3 years ago

I am unsure of whether I can use char or const char as a key. Is there documentation for how to add a custom type like the following?

struct CString_With_Length {
    char* data;
    size_t byte_length;
};

I would just like to use this for a key.

martinus commented 3 years ago

I'd use a std::string_view

KTRosenberg commented 3 years ago

I should’ve been more specific that I’d like to use a more complex custom type and was looking for instructions for managing the memory for that type. Also, I am hoping to remove dependencies on the std stl.

martinus commented 3 years ago

This is not specific to robin_hood map, please ask e.g. at https://www.reddit.com/r/cpp_questions/ or on stackoverflow