I have a class:
namespace App
{
template<typename A, typename B>
class MyClass
{
//...
class NestedClass
{
//...
}
}
} //namespace App
I would like to define a std::hash for NestedClass
//Definition of hash functions
namespace std
{
//Definition of a hash to use generic pairs as key
template<typename A, typename B>
struct hash<App::MyClass<A,B>::NestedClass>
{
public:
size_t operator()(const App::MyClass<A,B>::NestedClass &it) const
{
return std::hash(it.toInt());
}
};
}
I get the error:
source.h:1166: error: type/value mismatch at argument 1 in template parameter list for 'template<class _Tp> struct std::hash'
struct hash<App::MyClass<A,B>::const_NestedClass>
^
Any idea? Thanks!