mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
[10366] Add portable way for hash specialization adding.
Use it for ObjectGuid hash specialization
This commit is contained in:
parent
821bb9fcc4
commit
fbf4c5b3b4
3 changed files with 66 additions and 14 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue