diff options
Diffstat (limited to 'indra/llcommon/llpointer.h')
-rw-r--r-- | indra/llcommon/llpointer.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/indra/llcommon/llpointer.h b/indra/llcommon/llpointer.h index 9a6453ea48..f9de0c7929 100644 --- a/indra/llcommon/llpointer.h +++ b/indra/llcommon/llpointer.h @@ -340,4 +340,28 @@ private: bool mStayUnique; }; + +// boost hash adapter +template <class Type> +struct boost::hash<LLPointer<Type>> +{ + typedef LLPointer<Type> argument_type; + typedef std::size_t result_type; + result_type operator()(argument_type const& s) const + { + return (std::size_t) s.get(); + } +}; + +// Adapt boost hash to std hash +namespace std +{ + template<class Type> struct hash<LLPointer<Type>> + { + std::size_t operator()(LLPointer<Type> const& s) const noexcept + { + return boost::hash<LLPointer<Type>>()(s); + } + }; +} #endif |