Skip to content

Commit

Permalink
[FIX] fix the behavior of flatbuffers::Optional to match std::optiona…
Browse files Browse the repository at this point in the history
…l when lhs and rhs are both nullopt (#8223)

Co-authored-by: islander <mikudehuane@gmail.com>
Co-authored-by: Derek Bailey <derekbailey@google.com>
  • Loading branch information
3 people authored May 29, 2024
1 parent a5a2da0 commit 0f8b711
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/flatbuffers/stl_emulation.h
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ template<class T, class U>
FLATBUFFERS_CONSTEXPR_CPP11 bool operator==(const Optional<T>& lhs, const Optional<U>& rhs) FLATBUFFERS_NOEXCEPT {
return static_cast<bool>(lhs) != static_cast<bool>(rhs)
? false
: !static_cast<bool>(lhs) ? false : (*lhs == *rhs);
: !static_cast<bool>(lhs) ? true : (*lhs == *rhs);
}
#endif // FLATBUFFERS_USE_STD_OPTIONAL

Expand Down

0 comments on commit 0f8b711

Please sign in to comment.