mirror of
https://github.com/google/flatbuffers.git
synced 2026-07-02 07:28:19 +00:00
[FIX] fix the behavior of flatbuffers::Optional to match std::optional when lhs and rhs are both nullopt (#8223)
Co-authored-by: islander <mikudehuane@gmail.com> Co-authored-by: Derek Bailey <derekbailey@google.com>
This commit is contained in:
@@ -273,7 +273,7 @@ template<class T, class U>
|
|||||||
FLATBUFFERS_CONSTEXPR_CPP11 bool operator==(const Optional<T>& lhs, const Optional<U>& rhs) FLATBUFFERS_NOEXCEPT {
|
FLATBUFFERS_CONSTEXPR_CPP11 bool operator==(const Optional<T>& lhs, const Optional<U>& rhs) FLATBUFFERS_NOEXCEPT {
|
||||||
return static_cast<bool>(lhs) != static_cast<bool>(rhs)
|
return static_cast<bool>(lhs) != static_cast<bool>(rhs)
|
||||||
? false
|
? false
|
||||||
: !static_cast<bool>(lhs) ? false : (*lhs == *rhs);
|
: !static_cast<bool>(lhs) ? true : (*lhs == *rhs);
|
||||||
}
|
}
|
||||||
#endif // FLATBUFFERS_USE_STD_OPTIONAL
|
#endif // FLATBUFFERS_USE_STD_OPTIONAL
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user