5 #ifndef FLUTTER_IMPELLER_BASE_COMPARABLE_H_
6 #define FLUTTER_IMPELLER_BASE_COMPARABLE_H_
12 #include <type_traits>
31 virtual bool IsEqual(
const Type& other)
const = 0;
36 class = std::enable_if_t<std::is_base_of_v<ComparableBase, ComparableType>>>
38 std::size_t
operator()(
const ComparableType&
object)
const {
39 return object.GetHash();
45 class = std::enable_if_t<std::is_base_of_v<ComparableBase, ComparableType>>>
47 bool operator()(
const ComparableType& lhs,
const ComparableType& rhs)
const {
48 return lhs.IsEqual(rhs);
54 class = std::enable_if_t<std::is_base_of_v<ComparableBase, ComparableType>>>
56 const std::shared_ptr<ComparableType>& rhs) {
62 return lhs->IsEqual(*rhs);
71 class = std::enable_if_t<std::is_base_of_v<ComparableBase, ComparableType>>>
72 bool DeepCompareMap(
const std::map<Key, std::shared_ptr<ComparableType>>& lhs,
73 const std::map<Key, std::shared_ptr<ComparableType>>& rhs) {
74 if (lhs.size() != rhs.size()) {
78 for (
auto i = lhs.begin(), j = rhs.begin(); i != lhs.end(); i++, j++) {
79 if (i->first != j->first) {
virtual bool IsEqual(const Type &other) const =0
virtual std::size_t GetHash() const =0
bool DeepComparePointer(const std::shared_ptr< ComparableType > &lhs, const std::shared_ptr< ComparableType > &rhs)
bool DeepCompareMap(const std::map< Key, std::shared_ptr< ComparableType >> &lhs, const std::map< Key, std::shared_ptr< ComparableType >> &rhs)
bool operator()(const ComparableType &lhs, const ComparableType &rhs) const
std::size_t operator()(const ComparableType &object) const
constexpr auto operator<=>(const UniqueID &) const =default
constexpr std::size_t operator()(const impeller::UniqueID &id)