Selaa lähdekoodia

AK: Make `Vector::contains_slow` templated

This allows for calling this function with any argument type for which
the appropriate traits and operators have been implemented so it can be
compared to the Vector's item type
ForLoveOfCats 3 vuotta sitten
vanhempi
commit
79a2088a13
1 muutettua tiedostoa jossa 2 lisäystä ja 1 poistoa
  1. 2 1
      AK/Vector.h

+ 2 - 1
AK/Vector.h

@@ -203,7 +203,8 @@ public:
         return TypedTransfer<StorageType>::compare(data(), other.data(), size());
         return TypedTransfer<StorageType>::compare(data(), other.data(), size());
     }
     }
 
 
-    bool contains_slow(VisibleType const& value) const
+    template<typename V>
+    bool contains_slow(V const& value) const
     {
     {
         for (size_t i = 0; i < size(); ++i) {
         for (size_t i = 0; i < size(); ++i) {
             if (Traits<VisibleType>::equals(at(i), value))
             if (Traits<VisibleType>::equals(at(i), value))