12 #include <type_traits>
14 #include "flutter/fml/hash_combine.h"
15 #include "flutter/fml/macros.h"
25 return id == other.
id;
34 virtual std::size_t
GetHash()
const = 0;
36 virtual bool IsEqual(
const Type& other)
const = 0;
41 class = std::enable_if_t<std::is_base_of_v<ComparableBase, ComparableType>>>
43 std::size_t
operator()(
const ComparableType&
object)
const {
44 return object.GetHash();
50 class = std::enable_if_t<std::is_base_of_v<ComparableBase, ComparableType>>>
52 bool operator()(
const ComparableType& lhs,
const ComparableType& rhs)
const {
53 return lhs.IsEqual(rhs);
59 class = std::enable_if_t<std::is_base_of_v<ComparableBase, ComparableType>>>
61 const std::shared_ptr<ComparableType>& rhs) {
67 return lhs->IsEqual(*rhs);
76 class = std::enable_if_t<std::is_base_of_v<ComparableBase, ComparableType>>>
77 bool DeepCompareMap(
const std::map<Key, std::shared_ptr<ComparableType>>& lhs,
78 const std::map<Key, std::shared_ptr<ComparableType>>& rhs) {
79 if (lhs.size() != rhs.size()) {
83 for (
auto i = lhs.begin(), j = rhs.begin(); i != lhs.end(); i++, j++) {
84 if (i->first != j->first) {
111 return lhs.
id < rhs.
id;