summaryrefslogtreecommitdiff
path: root/AK
diff options
context:
space:
mode:
authorMuhammad Zahalqa <m@tryfinally.com>2020-09-06 22:49:59 +0300
committerAndreas Kling <kling@serenityos.org>2020-09-06 21:56:32 +0200
commit125ea6a2143994fded971fc35907befe2cddc2a6 (patch)
treebc72e00b0984f89ad703390438937b561503479b /AK
parentad3e6ef344441e0dff06fa7a04909924ea9cc81b (diff)
downloadserenity-125ea6a2143994fded971fc35907befe2cddc2a6.zip
AK: Vector use Traits<T>::equals in find
Use Traits<T>::equals for equality checking in search functions instead of operator==
Diffstat (limited to 'AK')
-rw-r--r--AK/Vector.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/AK/Vector.h b/AK/Vector.h
index aa5b3f5d46..f30fbdbd4b 100644
--- a/AK/Vector.h
+++ b/AK/Vector.h
@@ -249,7 +249,7 @@ public:
bool contains_slow(const T& value) const
{
for (size_t i = 0; i < size(); ++i) {
- if (at(i) == value)
+ if (Traits<T>::equals(at(i), value))
return true;
}
return false;
@@ -612,18 +612,18 @@ public:
ConstIterator find(const T& value) const
{
- return find([&](auto& other) { return value == other; });
+ return find([&](auto& other) { return Traits<T>::equals(value, other); });
}
Iterator find(const T& value)
{
- return find([&](auto& other) { return value == other; });
+ return find([&](auto& other) { return Traits<T>::equals(value, other); });
}
Optional<size_t> find_first_index(const T& value)
{
for (size_t i = 0; i < m_size; ++i) {
- if (value == at(i))
+ if (Traits<T>::equals(value, at(i)))
return i;
}
return {};