samedi 15 août 2020

Why standard does not provide specialization for hashing c strings with content examination

I am reading about hashing and I found following statement in here:

There is no specialization for C strings. std::hash<const char*> produces a hash of the value of the pointer (the memory address), it does not examine the contents of any character array.

Why there is no mechanism that hashes C strings that examine their content?

I was browsing code for std::string_view and it seems like it would come handy to cover both: std::string and std::string_view.

Aucun commentaire:

Enregistrer un commentaire