I tried to work out the exact syntax for this with unordered associative containers (also using GCC, as the OP asked) and hit this question.
Unfortunately, he did not go down to the level of detail that I wanted. Looking through the gcc headers about how they implemented the standard hash functions, I started working. Due to the lack of examples (at least at the time of writing) on โโthe Internet, I thought it would be as good as anyone to post my own example (which I can confirm by working with GCC):
namespace std { namespace tr1 { template <> struct hash<MyType> : public unary_function<MyType, size_t> { size_t operator()(const MyType& v) const { return ; } }; }}
(note that there are two namespaces here - this is just my agreement to collapse nested namespaces)
philsquared Apr 05 '09 at 14:27 2009-04-05 14:27
source share