I have such class
#ifndef _OBJECT_H_
#define _OBJECT_H_
#include <iostream>
#include <functional>
namespace core {
class Object {
protected:
template <>
struct std::hash<core::Object>
{
size_t operator()(const core::Object &x) const = 0;
};
public:
virtual Object* clone() = 0;
virtual int hashCode() = 0;
virtual std::string getClass() = 0;
virtual ~Object();
};
}
#endif
I want to force all inherited classes to implemented hash
calculation and provide ability to get hashcode
using implemented method for overriding ()
in hash
struct.
However my compiler shows Symbol 'hash' could not be resolved
error.
I am using Eclipse c++
with CDT
plugin and TDM gcc 5.1.0
. What's the problem?