You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to write a class template that accepts a Hashmap as a template parameter, but in a way where the key and value types do not have to be defined, and instead are set by the class:
in order to allow for easy usage (user does not have to provide std::string and int), and because the key/value types are meant to be internal to the class anyway.
In other words, I'd like the class to be usable like this:
This however fails to compile for parallel_flat_hash_map, as it contains a template parameter size_t N = 4, and non-type parameters are not allowed in variadic template template parameters...
Is there a way to get this to work, or do I have to change the template arguments of MyClass and have the user specify
Thanks! It didn't work with exactly that, as the N template param seems to be needed (and it isn't part of your suggested typedef), but as I am happy with the defaults for most template params anyway, I got it to work with this:
template <typename K, typename V>
using parallel_flat_hash_map = phmap::parallel_flat_hash_map<K, V>;
I am trying to write a class template that accepts a Hashmap as a template parameter, but in a way where the key and value types do not have to be defined, and instead are set by the class:
in order to allow for easy usage (user does not have to provide
std::string
andint
), and because the key/value types are meant to be internal to the class anyway.In other words, I'd like the class to be usable like this:
This however fails to compile for
parallel_flat_hash_map
, as it contains a template parametersize_t N = 4
, and non-type parameters are not allowed in variadic template template parameters...Is there a way to get this to work, or do I have to change the template arguments of
MyClass
and have the user specifyexplicitly each time?
Thank you in advance!
Lucas
The text was updated successfully, but these errors were encountered: