refactor(templates): remove the GetData function from the non-container class

This commit is contained in:
2022-04-24 22:42:40 +08:00
parent b3a97cfe21
commit c2eca8df1e
5 changed files with 85 additions and 129 deletions

View File

@ -189,9 +189,6 @@ public:
constexpr bool IsValid() const { return bIsValid; }
constexpr explicit operator bool() const { return bIsValid; }
constexpr void* GetData() { return &Value; }
constexpr const void* GetData() const { return &Value; }
constexpr OptionalType& GetValue() & { checkf(IsValid(), TEXT("It is an error to call GetValue() on an unset TOptional. Please either check IsValid() or use Get(DefaultValue) instead.")); return *reinterpret_cast< OptionalType*>(&Value); }
constexpr OptionalType&& GetValue() && { checkf(IsValid(), TEXT("It is an error to call GetValue() on an unset TOptional. Please either check IsValid() or use Get(DefaultValue) instead.")); return MoveTemp(*reinterpret_cast< OptionalType*>(&Value)); }
constexpr const OptionalType& GetValue() const& { checkf(IsValid(), TEXT("It is an error to call GetValue() on an unset TOptional. Please either check IsValid() or use Get(DefaultValue) instead.")); return *reinterpret_cast<const OptionalType*>(&Value); }