I need to hash a combination of four different things, comprising 20 bytes, as such I defined this:
struct holder
{
char a;
uint16_t b;
uint64_t c;
char d[9];
} __attribute((__packed__));
and then I can load one of the above and pass it to a hash function. So then I want my class Foo to have a std::tr1::unordered_map<holder, int> map. but in order to declare that in the header file for Foo, I need to include the definition of holder, the template specialization inside std::tr1 for hash for my type, and as a result the full hash function. Is there a way to not have all this code up in the header but still give my class this hashmap?
Simply declare the function in a header file, and define it at a cpp file.
This would look like: