feat(templates): add type hash support and the corresponding testing
This commit is contained in:
@ -2,6 +2,7 @@
|
||||
|
||||
#include "CoreTypes.h"
|
||||
#include "Templates/Utility.h"
|
||||
#include "Templates/TypeHash.h"
|
||||
#include "Concepts/Comparable.h"
|
||||
#include "TypeTraits/TypeTraits.h"
|
||||
#include "Miscellaneous/AssertionMacros.h"
|
||||
@ -189,6 +190,12 @@ public:
|
||||
constexpr OptionalType& Get( OptionalType& DefaultValue) & { return IsValid() ? GetValue() : DefaultValue; }
|
||||
constexpr const OptionalType& Get(const OptionalType& DefaultValue) const& { return IsValid() ? GetValue() : DefaultValue; }
|
||||
|
||||
constexpr size_t GetTypeHash() const requires CHashable<OptionalType>
|
||||
{
|
||||
if (!IsValid()) return NAMESPACE_REDCRAFT::GetTypeHash(nullptr);
|
||||
return NAMESPACE_REDCRAFT::GetTypeHash(GetValue());
|
||||
}
|
||||
|
||||
constexpr void Reset()
|
||||
{
|
||||
if (bIsValid)
|
||||
|
Reference in New Issue
Block a user