Closed Ybalrid closed 4 years ago
This may be a defect in clang or its standard library.
One solution would be to specialize std::hash
for KeyCode
. Adding this to the bottom of OISKeyboard.h
works:
namespace std {
template <> struct hash<OIS::KeyCode> {
size_t operator() (OIS::KeyCode code) const {
return static_cast<size_t>(code);
}
};
}
Note that specializing std::hash
is explicitly allowed by the standard.
Another way would be to change the line
typedef std::unordered_map<KeyCode, KeySym> OIStoX_KeyMap;
in LinuxKeyboard.h to
typedef std::unordered_map<KeyCode, KeySym, std::hash<int>> OIStoX_KeyMap;
Both solutions fix the Travis build and also work on AppVeyor. Do you want me to create a pull request for one of them?
See this : https://travis-ci.org/wgois/OIS/jobs/587741226#L826