fix(templates): fix TOptional's operator!= returned an wrong value for invalid value

This commit is contained in:
_Redstone_c_ 2022-03-15 11:52:46 +08:00
parent 48a344796a
commit f7b611febc
2 changed files with 2 additions and 1 deletions

View File

@ -230,6 +230,7 @@ void TestOptional()
TempO.Reset();
always_check(TempO == TempO);
always_check(!(TempO != TempO));
always_check(TempO.Get(500) == 500);
int32 TempP = 200;

View File

@ -223,7 +223,7 @@ template <typename T, typename U>
constexpr bool operator!=(const TOptional<T>& LHS, const TOptional<U>& RHS)
{
if (LHS.IsValid() != RHS.IsValid()) return true;
if (LHS.IsValid() == false) return true;
if (LHS.IsValid() == false) return false;
return *LHS != *RHS;
}