I have a template class looking like this:
template <int N, class TypeId> class Indexer {
...
}
and I want to use it in std::unordered_map
, I need a hash function. In the codebase we already had something similar (but on an untemplated class) so I tried to do it like this:
namespace std {
template <int N, class TypeId>
struct hash<Indexer<N, TypeId> > {
size_t operator()(const Indexer<N, TypeId>& id) const noexcept {
...
}
};
}
It is also quite similar to another answer. Unfortunately this does not work, just gives a bunch of unhelpfull errors. Any insights?
Aucun commentaire:
Enregistrer un commentaire