Workaround a release blocker after libc++ change (flutter/engine#43091)

The code breaks in C++20 mode after libc++ removes comparisons for `std::vector` and replaces them with 'operator <=>'.

See cl/542541552 for context.
This commit is contained in:
Lau Ching Jun
2023-06-22 12:33:44 -07:00
committed by GitHub
parent bb015ab8c5
commit 574191ed36

View File

@@ -215,6 +215,13 @@ class EncodableValue : public internal::EncodableValueVariant {
}
return std::get<int64_t>(*this);
}
// Explicitly provide operator<, delegating to std::variant's operator<.
// There are issues with with the way the standard library-provided
// < and <=> comparisons interact with classes derived from variant.
friend bool operator<(const EncodableValue& lhs, const EncodableValue& rhs) {
return static_cast<const super&>(lhs) < static_cast<const super&>(rhs);
}
};
} // namespace flutter