defining hash in tr1 for a template class

0 down vote favorite


I have the class Gateway. I need to store object of this class in a hash table (using tr1::unordered_set). I've used both the unorderd_set and the class Gateway in oder context and they work fine yet I can't figure how to pu a gateway in a unordered set cause I can't define its hash function in tr1's namespace.

I've tried: (and many oter variants)
1
2
3
4
5
6
namespace std {
  namespace tr1 { 
    template<> inline size_t hash<(typename Gateway)>::operator()(Gateway gT) const {
      return gT.getCore()->hash(); //!DOESN't WORK 
    } 
 }


Compiler says the this (typename Gateway) is wrong. If i take the () off it assumes the >> in the end of hash> is the output stream.

While in the past i've done this

1
2
3
4
5
6
namespace std {
  namespace tr1 { 
    template<> inline size_t hash::operator()(Board b) const { 
      return b.hash(); //!WORKS FINE 
    } 
 }



Can anyone shed some light on the problem?
Last edited on
Topic archived. No new replies allowed.