| Index: third_party/WebKit/Source/wtf/Vector.h
|
| diff --git a/third_party/WebKit/Source/wtf/Vector.h b/third_party/WebKit/Source/wtf/Vector.h
|
| index 9722d7eaf906fa9b3ba5615311f2c6ea71f8c43c..5b50284b29f3c98f244e66884144907583cd4659 100644
|
| --- a/third_party/WebKit/Source/wtf/Vector.h
|
| +++ b/third_party/WebKit/Source/wtf/Vector.h
|
| @@ -271,6 +271,26 @@ struct VectorComparer<true, T> {
|
| };
|
|
|
| template <typename T>
|
| +struct VectorElementComparer {
|
| + STATIC_ONLY(VectorElementComparer);
|
| + template <typename U>
|
| + static bool compareElement(const T& left, const U& right)
|
| + {
|
| + return left == right;
|
| + }
|
| +};
|
| +
|
| +template <typename T>
|
| +struct VectorElementComparer<std::unique_ptr<T>> {
|
| + STATIC_ONLY(VectorElementComparer);
|
| + template <typename U>
|
| + static bool compareElement(const std::unique_ptr<T>& left, const U& right)
|
| + {
|
| + return left.get() == right;
|
| + }
|
| +};
|
| +
|
| +template <typename T>
|
| struct VectorTypeOperations {
|
| STATIC_ONLY(VectorTypeOperations);
|
| static void destruct(T* begin, T* end)
|
| @@ -312,6 +332,12 @@ struct VectorTypeOperations {
|
| {
|
| return VectorComparer<VectorTraits<T>::canCompareWithMemcmp, T>::compare(a, b, size);
|
| }
|
| +
|
| + template <typename U>
|
| + static bool compareElement(const T& left, U&& right)
|
| + {
|
| + return VectorElementComparer<T>::compareElement(left, std::forward<U>(right));
|
| + }
|
| };
|
|
|
| template <typename T, bool hasInlineCapacity, typename Allocator>
|
| @@ -1095,7 +1121,7 @@ size_t Vector<T, inlineCapacity, Allocator>::find(const U& value) const
|
| const T* b = begin();
|
| const T* e = end();
|
| for (const T* iter = b; iter < e; ++iter) {
|
| - if (*iter == value)
|
| + if (TypeOperations::compareElement(*iter, value))
|
| return iter - b;
|
| }
|
| return kNotFound;
|
| @@ -1109,7 +1135,7 @@ size_t Vector<T, inlineCapacity, Allocator>::reverseFind(const U& value) const
|
| const T* iter = end();
|
| while (iter > b) {
|
| --iter;
|
| - if (*iter == value)
|
| + if (TypeOperations::compareElement(*iter, value))
|
| return iter - b;
|
| }
|
| return kNotFound;
|
|
|