feat(templates): add type hash support and the corresponding testing
This commit is contained in:
@ -2,6 +2,7 @@
|
||||
|
||||
#include "CoreTypes.h"
|
||||
#include "Templates/Invoke.h"
|
||||
#include "Templates/TypeHash.h"
|
||||
#include "Templates/Utility.h"
|
||||
#include "TypeTraits/TypeTraits.h"
|
||||
#include "Miscellaneous/AssertionMacros.h"
|
||||
@ -418,6 +419,12 @@ struct TVariant
|
||||
return R(NAMESPACE_PRIVATE::TVariantVisitHelper<R, F, Types...>::VisitConstRValueFuncs[GetIndex()](Forward<F>(Func), &Value));
|
||||
}
|
||||
|
||||
constexpr size_t GetTypeHash() const requires (true && ... && CHashable<Types>)
|
||||
{
|
||||
if (!IsValid()) return NAMESPACE_REDCRAFT::GetTypeHash(nullptr);
|
||||
return Visit([](auto&& A) { return NAMESPACE_REDCRAFT::GetTypeHash(A); });
|
||||
}
|
||||
|
||||
constexpr void Reset()
|
||||
{
|
||||
if (GetIndex() == INDEX_NONE) return;
|
||||
|
Reference in New Issue
Block a user