From 66ba27cb91b4f81625b8ab535f41bcf38a2aae99 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Mon, 27 Nov 2017 10:19:43 -0800 Subject: Added boost::hash<> spec for LLSD --- indra/llcommon/lluuid.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'indra/llcommon/lluuid.h') diff --git a/indra/llcommon/lluuid.h b/indra/llcommon/lluuid.h index dd8660a3c8..fe7482ba29 100644 --- a/indra/llcommon/lluuid.h +++ b/indra/llcommon/lluuid.h @@ -31,6 +31,7 @@ #include #include "stdtypes.h" #include "llpreprocessor.h" +#include class LLMutex; @@ -164,6 +165,25 @@ public: LLAssetID makeAssetID(const LLUUID& session) const; }; +// Generate a hash of an LLUUID object using the boost hash templates. +template <> +struct boost::hash +{ + typedef LLUUID argument_type; + typedef std::size_t result_type; + result_type operator()(argument_type const& s) const + { + result_type seed(0); + + for (S32 i = 0; i < UUID_BYTES; ++i) + { + boost::hash_combine(seed, s.mData[i]); + } + + return seed; + } +}; + #endif -- cgit v1.2.3