Skip to content

Commit 9f8620a

Browse files
authored
Fix incorrect AsciiString hash implementation for non-stlport (#507)
Copy the fixes that were made in the zero hour code by Xezon.
1 parent db13e8b commit 9f8620a

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

Generals/Code/GameEngine/Include/Common/STLTypedefs.h

+9-4
Original file line numberDiff line numberDiff line change
@@ -204,10 +204,15 @@ namespace rts
204204

205205
template<> struct hash<AsciiString>
206206
{
207-
size_t operator()(AsciiString ast) const
208-
{
209-
std::hash<const char *> tmp;
210-
return tmp((const char *) ast.str());
207+
size_t operator()(const AsciiString& ast) const
208+
{
209+
#ifdef USING_STLPORT
210+
std::hash<const char*> tmp;
211+
return tmp((const char*)ast.str());
212+
#else
213+
std::hash<std::string_view> hasher;
214+
return hasher(std::string_view(ast.str(), ast.getLength()));
215+
#endif
211216
}
212217
};
213218

0 commit comments

Comments
 (0)