[10366] Add portable way for hash specialization adding.

Use it for ObjectGuid hash specialization
This commit is contained in:
VladimirMangos 2010-08-17 23:54:52 +04:00
parent 821bb9fcc4
commit fbf4c5b3b4
3 changed files with 66 additions and 14 deletions

View file

@ -22,6 +22,8 @@
#include "Common.h"
#include "ByteBuffer.h"
#include <functional>
enum TypeID
{
TYPEID_OBJECT = 0,
@ -277,4 +279,19 @@ ByteBuffer& operator>> (ByteBuffer& buf, PackedGuidReader const& guid);
inline PackedGuid ObjectGuid::WriteAsPacked() const { return PackedGuid(*this); }
HASH_NAMESPACE_START
template<>
class hash<ObjectGuid>
{
public:
size_t operator() (ObjectGuid const& key) const
{
return hash<uint64>()(key.GetRawValue());
}
};
HASH_NAMESPACE_END
#endif