-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for custom hash() callback, allowing "non-hashable" keys, eg. vector #8
Comments
the easiest way is to define a std::hash<> for your vector object for a vector it might be worthwhile to look into boost::hash_combine() |
I know about the |
you can specify the MapType in the template params have you tried with
you'll need to I'm currently away from my dev machine and will try this later. If that works, I will close this issue |
I'll test this approach, thank you very much 👍 |
the err is caused by the type I wish to use for a key:
Even though as I understand, the
operator==
is defined well forvector<>
, so also hashing(?) should work?Is there any way to use the vector/array type as a key for the cache?
I found a solution/workaround in:
Can we pass a
Hash=myHashFn
in the template header the same way aLock=
is used? That would attempt to callmyHashFn(key)
each time a key is used to address the cache, allowing to hash the so-far unsupported key types (vector, tuple, ...)Below is report and "historical development" of my point of view on the issue:
Ok, so #3 enables the samples to compile and all code in #7 runs.
On a more complex program I'm however hitting a "template" problem:
Can you help me with it please @mohaps ?
My
./configure
(cmake), if that helps:Thank you very much
The text was updated successfully, but these errors were encountered: