Flutter Engine
Loading...
Searching...
No Matches
dl_comparable.h
Go to the documentation of this file.
1
// Copyright 2013 The Flutter Authors. All rights reserved.
2
// Use of this source code is governed by a BSD-style license that can be
3
// found in the LICENSE file.
4
5
#ifndef FLUTTER_DISPLAY_LIST_UTILS_DL_COMPARABLE_H_
6
#define FLUTTER_DISPLAY_LIST_UTILS_DL_COMPARABLE_H_
7
8
#include <memory>
9
10
namespace
flutter
{
11
12
// These templates implement deep pointer comparisons that compare not
13
// just the pointers to the objects, but also their contents (provided
14
// that the <T> class implements the == operator override).
15
// Any combination of shared_ptr<T> or T* are supported and null pointers
16
// are not equal to anything but another null pointer.
17
18
template
<
class
T,
class
U>
19
bool
Equals
(
const
T* a,
const
U* b) {
20
if
(a == b) {
21
return
true
;
22
}
23
if
(!a || !b) {
24
return
false
;
25
}
26
return
*a == *b;
27
}
28
29
template
<
class
T,
class
U>
30
bool
Equals
(
const
std::shared_ptr<const T>& a,
const
U* b) {
31
return
Equals
(a.get(), b);
32
}
33
34
template
<
class
T,
class
U>
35
bool
Equals
(
const
std::shared_ptr<T>& a,
const
U* b) {
36
return
Equals
(a.get(), b);
37
}
38
39
template
<
class
T,
class
U>
40
bool
Equals
(
const
T* a,
const
std::shared_ptr<const U>& b) {
41
return
Equals
(a, b.get());
42
}
43
44
template
<
class
T,
class
U>
45
bool
Equals
(
const
T* a,
const
std::shared_ptr<U>& b) {
46
return
Equals
(a, b.get());
47
}
48
49
template
<
class
T,
class
U>
50
bool
Equals
(
const
std::shared_ptr<const T>& a,
51
const
std::shared_ptr<const U>& b) {
52
return
Equals
(a.get(), b.get());
53
}
54
55
template
<
class
T,
class
U>
56
bool
Equals
(
const
std::shared_ptr<T>& a,
const
std::shared_ptr<const U>& b) {
57
return
Equals
(a.get(), b.get());
58
}
59
60
template
<
class
T,
class
U>
61
bool
Equals
(
const
std::shared_ptr<const T>& a,
const
std::shared_ptr<U>& b) {
62
return
Equals
(a.get(), b.get());
63
}
64
65
template
<
class
T,
class
U>
66
bool
Equals
(
const
std::shared_ptr<T>& a,
const
std::shared_ptr<U>& b) {
67
return
Equals
(a.get(), b.get());
68
}
69
70
template
<
class
T,
class
U>
71
bool
NotEquals
(
const
T* a,
const
U* b) {
72
return
!
Equals
(a, b);
73
}
74
75
template
<
class
T,
class
U>
76
bool
NotEquals
(
const
std::shared_ptr<const T>& a,
const
U* b) {
77
return
!
Equals
(a.get(), b);
78
}
79
80
template
<
class
T,
class
U>
81
bool
NotEquals
(
const
std::shared_ptr<T>& a,
const
U* b) {
82
return
!
Equals
(a.get(), b);
83
}
84
85
template
<
class
T,
class
U>
86
bool
NotEquals
(
const
T* a,
const
std::shared_ptr<const U>& b) {
87
return
!
Equals
(a, b.get());
88
}
89
90
template
<
class
T,
class
U>
91
bool
NotEquals
(
const
T* a,
const
std::shared_ptr<U>& b) {
92
return
!
Equals
(a, b.get());
93
}
94
95
template
<
class
T,
class
U>
96
bool
NotEquals
(
const
std::shared_ptr<const T>& a,
97
const
std::shared_ptr<const U>& b) {
98
return
!
Equals
(a.get(), b.get());
99
}
100
101
template
<
class
T,
class
U>
102
bool
NotEquals
(
const
std::shared_ptr<T>& a,
const
std::shared_ptr<const U>& b) {
103
return
!
Equals
(a.get(), b.get());
104
}
105
106
template
<
class
T,
class
U>
107
bool
NotEquals
(
const
std::shared_ptr<const T>& a,
const
std::shared_ptr<U>& b) {
108
return
!
Equals
(a.get(), b.get());
109
}
110
111
template
<
class
T,
class
U>
112
bool
NotEquals
(
const
std::shared_ptr<T>& a,
const
std::shared_ptr<U>& b) {
113
return
!
Equals
(a.get(), b.get());
114
}
115
116
}
// namespace flutter
117
118
#endif
// FLUTTER_DISPLAY_LIST_UTILS_DL_COMPARABLE_H_
flutter
Definition
asset_manager.cc:10
flutter::Equals
bool Equals(const T *a, const U *b)
Definition
dl_comparable.h:19
flutter::NotEquals
bool NotEquals(const T *a, const U *b)
Definition
dl_comparable.h:71
display_list
utils
dl_comparable.h
Generated on Wed Nov 5 2025 21:33:11 for Flutter Engine by
1.9.8