[+] Support for AuPair<T,Z>s as hashtable and binary tree keys

This commit is contained in:
Reece Wilson 2023-03-05 13:19:36 +00:00
parent 541e31b198
commit 55b0dafa56

View File

@ -217,6 +217,21 @@ inline AuUInt AuHashCode(const T &ref)
return AuHash::hash<T>()(ref); return AuHash::hash<T>()(ref);
} }
#include <auROXTL/auTuple.hpp>
namespace AuHash
{
template <typename T, typename Z>
struct hash<AuPair<T, Z>>
{
constexpr AuUInt operator ()(const AuPair<T, Z> &pair) const
{
return AuHashCode(AuGet<0>(pair)) ^
AuHashCode(AuGet<1>(pair));
}
};
}
template <class T> template <class T>
struct AuEnableHashCodeOnData struct AuEnableHashCodeOnData
{ {
@ -228,4 +243,4 @@ struct AuEnableHashCodeOnData
return AuFnv1a64Runtime(AuStaticCast<AuAddConst_t<T>>(this), sizeof(T)); return AuFnv1a64Runtime(AuStaticCast<AuAddConst_t<T>>(this), sizeof(T));
#endif #endif
} }
}; };